[llvm] [InstCombine] Add support for GEPs in `simplifyNonNullOperand` (PR #128365)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 00:51:40 PST 2025
================
@@ -3996,8 +3996,12 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
if (V->getType()->isPointerTy()) {
// Simplify the nonnull operand if the parameter is known to be nonnull.
// Otherwise, try to infer nonnull for it.
- if (Call.paramHasNonNullAttr(ArgNo, /*AllowUndefOrPoison=*/true)) {
- if (Value *Res = simplifyNonNullOperand(V)) {
+ bool HasDereferenceable = Call.getParamDereferenceableBytes(ArgNo) > 0;
----------------
nikic wrote:
Alternatively, could add a HasDereferenceable out parameter to paramHasNonNullAttr.
https://github.com/llvm/llvm-project/pull/128365
More information about the llvm-commits
mailing list