[clang] Reland "[clang] Add nuw attribute to GEPs (#105496)" (PR #107257)

Sam Clegg via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 13:36:50 PST 2024


sbc100 wrote:

I bisecting this emscripten (wasm32-unknown-emscripten) miscompile to this PR: https://github.com/emscripten-core/emscripten/issues/22794.

It looks like llvm is generating a load with a negative office (which is not supported under wasm).   There is a reproducer in that but and I used the following commend to detect the bad load:

```
$ clang++ --target=wasm32-unknown-emscripten -std=c++20 -O2 -c 3.1.71_temps/GltfImporter.ii && wasm-objdump -d GltfImporter.o | grep i64.load.*4294967280
 01c4a3: 29 02 f0 ff ff ff 0f       |               i64.load 2 4294967280
```

Here you can see an i64.load instruction with an offset of 4294967280 (which is -16 interpreted as an unsigned int).


https://github.com/llvm/llvm-project/pull/107257


More information about the cfe-commits mailing list