Skip to content

Commit 3b07a69

Browse files
committed
Address review comments
1 parent 12f5eff commit 3b07a69

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3077,10 +3077,9 @@ Instruction *InstCombinerImpl::foldICmpAddConstant(ICmpInst &Cmp,
30773077
return new ICmpInst(Pred, X, ConstantInt::get(Ty, NewC));
30783078
}
30793079

3080-
ConstantRange LHS_CR = computeConstantRange(X, true).add(*C2);
30813080
if (ICmpInst::isUnsigned(Pred) && Add->hasNoSignedWrap() &&
3082-
C.isNonNegative() && LHS_CR.isAllNonNegative() &&
3083-
(C - *C2).isNonNegative())
3081+
C.isNonNegative() && (C - *C2).isNonNegative() &&
3082+
computeConstantRange(X, /*ForSigned=*/true).add(*C2).isAllNonNegative())
30843083
return new ICmpInst(ICmpInst::getSignedPredicate(Pred), X,
30853084
ConstantInt::get(Ty, C - *C2));
30863085

0 commit comments

Comments
 (0)