[llvm] [InstSimplify] Fold `getelementptr inbounds null, idx -> null` (PR #130742)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 08:20:18 PDT 2025


nikic wrote:

> Or just switch to the original version [02065e8](https://github.com/llvm/llvm-project/commit/02065e86c63ab3fbdefd2ce6e963ffeec96e6a24)

I don't think it would cover this particular case (as it's pointer addition, not member offset), but generally, yes, I feel like making use of the constant folding result does make sense in this context. We can't guarantee it as a language extension in that form, but "don't emit inbounds on gep null" seems like a reasonable thing to do as a matter of QoI.

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


More information about the llvm-commits mailing list