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

2024-11-18 Thread Sam Clegg via cfe-commits
sbc100 wrote: I used `wasm-reduce` on the `.ll` file and it looks like you were correct. The result was: ``` target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20" target triple = "wasm32-unknown-emscripten"

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

2024-11-18 Thread Nikita Popov via cfe-commits
nikic wrote: @sbc100 That wasm is not necessarily a miscompile, it may be UB in the source program, if it uses a negative number in an *unsigned* variable to index an array. Is the affected code clean under ubsan? (See https://github.com/llvm/llvm-project/issues/108770 for a similar report tha

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

2024-11-18 Thread Sam Clegg via cfe-commits
sbc100 wrote: Perhaps yes. Do you know of any way to reduce the input program into something we can try to inspect. The preprocessed C++ file is over 100,000 lines :-/ https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cf

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

2024-11-18 Thread Sam Clegg via cfe-commits
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

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

2024-09-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Should be fixed by > https://github.com/llvm/llvm-project/commit/940f89255e4a3982d94dad57837e8e658092af78. I quickly glanced through the other uses of setIsInBounds in LLVM; the one in CodeGenPrepare seems suspicious. https://github.com/llvm/llvm-project/pull/107257 ___

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

2024-09-13 Thread Arseny Kapoulkine via cfe-commits
zeux wrote: Confirming this fixes the original problem on the larger codebase, thanks! https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-13 Thread Nikita Popov via cfe-commits
nikic wrote: Should be fixed by https://github.com/llvm/llvm-project/commit/940f89255e4a3982d94dad57837e8e658092af78. https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

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

2024-09-12 Thread Nikita Popov via cfe-commits
nikic wrote: Reduced: https://llvm.godbolt.org/z/TPdd9qore I believe the problem is this line: https://github.com/llvm/llvm-project/blob/c05e29bff036060f0811b887a92715104abdceb5/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L2513 This does an in-place modification of the GEP, but on

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

2024-09-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Reproduced: https://godbolt.org/z/G4jrhdjef . Looks like an instcombine bug. https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

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

2024-09-12 Thread Arseny Kapoulkine via cfe-commits
zeux wrote: Here's a slightly smaller reproducer that just reads one element from the array. Similarly, this crashes because the compiler generates a load from an absolute `-1` address. The crash is after the first `printf` call in this case during the computation of the argument to the second

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

2024-09-12 Thread Arseny Kapoulkine via cfe-commits
zeux wrote: This change leads to a miscompilation; I've extracted a somewhat minimal repro case from the referenced issue above, in the comment: https://github.com/zeux/pugixml/issues/629#issuecomment-2346839855 The code, when compiled with `-O2 -g` by latest clang on Linux/X64, generates the

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

2024-09-05 Thread Hari Limaye via cfe-commits
https://github.com/hazzlim closed https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-05 Thread Hari Limaye via cfe-commits
hazzlim wrote: Nice - CI seems happy, so I plan to land this later today if no objections. https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

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

2024-09-04 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LG if CI is happy. https://github.com/llvm/llvm-project/pull/107257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits