================
@@ -524,9 +524,7 @@ define i64 @utest_f64i64(double %x) {
 ; CHECK-NEXT:    local.get 0
 ; CHECK-NEXT:    call __fixunsdfti
 ; CHECK-NEXT:    local.get 1
-; CHECK-NEXT:    i32.const 8
-; CHECK-NEXT:    i32.add
-; CHECK-NEXT:    i64.load 0
+; CHECK-NEXT:    i64.load 8
----------------
sunfishcode wrote:

The issue is a missing nuw. Wasm load/store instructions' offsets don't perform 
wrapping, so constant folding adds into them usually requires the adds to have 
nuw or similar. In these tests, there's a 16-byte load that's getting split 
into two 8-byte loads, and the second one has a "+ 8" on its base address, so 
the question is, can we prove that add doesn't overflow. When the base 
alignment is known to be 16 bytes, then we can. But also, at a higher level, 
the legalization code should know that the original 16-byte load doesn't half 
wrap around, so it can just put nuw on the add up front, in which case we can 
always fold it.

I've now submittted https://github.com/llvm/llvm-project/pull/119288 to 
implement that.


https://github.com/llvm/llvm-project/pull/119204
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to