[llvm] [WebAssembly] Fold unsigned offset (PR #145829)
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 13:50:03 PDT 2025
================
@@ -12,8 +12,8 @@ define i32 @load_test0() {
; CHECK-LABEL: load_test0:
; CHECK: .functype load_test0 () -> (i32)
; CHECK-NEXT: # %bb.0:
-; CHECK-NEXT: global.get $push0=, g at GOT
-; CHECK-NEXT: i32.load $push1=, 40($pop0)
+; CHECK-NEXT: i32.const $push0=, 40
+; CHECK-NEXT: i32.load $push1=, g at GOT($pop0)
----------------
dschuff wrote:
This doesn't look right to me. The `g at GOT` should resolve to a R_GLOBAL_INDEX_LEB relocation, i.e. a global index, not an address itself. The address is the value stored in the global, not the global index. So you can't swap these. I'm not actually sure what the operands look like in SelectionDAG in PIC mode, but I think there needs to be some sort of restriction on the TargetGlobalAddress for that case. Same for `__wasm_lpad_context` below.
https://github.com/llvm/llvm-project/pull/145829
More information about the llvm-commits
mailing list