[clang] [llvm] [WebAssembly] Add `-i128:128` to the `datalayout` string. (PR #119204)

Dan Gohman via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 15:39:12 PST 2024


================
@@ -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


More information about the cfe-commits mailing list