[llvm] [SeparateConstOffsetFromGEP] Fix incorrect inbounds flag in case of non-negative index but negative offset (PR #190192)

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 08:30:39 PDT 2026


ritter-x2a wrote:

I might be misunderstanding something here, but isn't the case you describe poison in the input program?
`inbounds` implies `nusw` (according to the [langref](https://llvm.org/docs/LangRef.html#id241)), which says that "The multiplication of an index by the type size does not wrap the pointer index type in a signed sense (mul nsw)."

The case where a GEP has `inbounds` and the index is non-negative, but its offset (in bytes) is negative as you describe would violate that, right?

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


More information about the llvm-commits mailing list