[llvm-branch-commits] [llvm] [SDAG] Introduce inbounds flag for pointer arithmetic (PR #131862)
Fabian Ritter via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 28 06:40:20 PDT 2025
ritter-x2a wrote:
> Actually, thinking about it a bit more, the "allocated object" referenced in the LangRef spec doesn't actually have to be live. So you also have to worry about objects which were previously allocated at the same address... which means inbounds is basically meaningless for a pointer created using inttoptr.
Is your point here that we cannot justify any transformation based on `inbounds` unless we prove that the base pointer is not the (direct or indirect) result of inttoptr?
I don't agree with that. An inbounds gep tells us that there is (or was) some object that the base pointer points into (or just after) and the result still points into (or just after) that object; otherwise the result is poison.
That's for instance useful if your architecture has memory segments whose borders allocated objects cannot cross and where you can only fold offsets into memory access instructions if they don't leave the memory segment of the base address.
https://github.com/llvm/llvm-project/pull/131862
More information about the llvm-branch-commits
mailing list