File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
llvm/lib/Transforms/InstCombine Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -3994,18 +3994,17 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
39943994
39953995 for (Value *V : Call.args ()) {
39963996 if (V->getType ()->isPointerTy ()) {
3997- // Simplify the nonnull operand before nonnull inference to avoid
3998- // unnecessary queries .
3997+ // Simplify the nonnull operand if the parameter is known to be nonnull.
3998+ // Otherwise, try to infer nonnull for it .
39993999 if (Call.paramHasNonNullAttr (ArgNo, /* AllowUndefOrPoison=*/ true )) {
40004000 if (Value *Res = simplifyNonNullOperand (V)) {
40014001 replaceOperand (Call, ArgNo, Res);
40024002 Changed = true ;
40034003 }
4004- }
4005-
4006- if (!Call.paramHasAttr (ArgNo, Attribute::NonNull) &&
4007- isKnownNonZero (V, getSimplifyQuery ().getWithInstruction (&Call)))
4004+ } else if (isKnownNonZero (V,
4005+ getSimplifyQuery ().getWithInstruction (&Call))) {
40084006 ArgNos.push_back (ArgNo);
4007+ }
40094008 }
40104009 ArgNo++;
40114010 }
You can’t perform that action at this time.
0 commit comments