diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index ca0be4d..287538b 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -1182,6 +1182,15 @@ where &self, value: inkwell::values::IntValue<'ctx>, ) -> anyhow::Result> { + if value.get_type() == self.xlen_type() { + return Ok(value); + } + assert_eq!( + value.get_type(), + self.word_type(), + "expected XLEN or WORD sized int type for memory offset", + ); + let truncated = self.builder().build_int_truncate_or_bit_cast( value, self.xlen_type(),