Skip to content

Commit 0ff99b1

Browse files
committed
[InstCombine] Address review comments.
1 parent 1a5f3fb commit 0ff99b1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)