[llvm] [InstCombine] Fix select combine with null_pointer_is_valid. (PR #227168)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 11:47:38 PDT 2026
================
----------------
efriedma-quic wrote:
In HasDereferenceable mode, we don't prove that the base operand of the GEP is non-null (in the sense that its address bits are non-zero). Consider the following example:
```
%addrbits = ptrtoaddr ptr %p to i64
%negaddrbits = ptrtoaddr ptr %p to i64
%nullp = getelementptr i8, ptr %p, %negaddrbits
%select = select i1 %cond, ptr %nullp, ptr null
%gep = getelementptr i8, ptr %select, i64 %addrbits
%l = load i64, ptr %gep
```
We recursively call simplifyNonNullOperand on %select, which is always null (in the sense that the address bits are zero). This isn't actually a problem, but we need to be clear what's happening.
https://github.com/llvm/llvm-project/pull/227168
More information about the llvm-commits
mailing list