Skip to content

Commit b0904ca

Browse files
AZero13dtcxzyw
andauthored
Update ValueTracking.cpp
Co-authored-by: Yingwei Zheng <[email protected]>
1 parent b28f157 commit b0904ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9599,7 +9599,7 @@ static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
95999599
// INT_MIN, so -INT_MIN - 1 is INT_MAX, so it is SINT_MAX - (C - 1),
96009600
// or SINT_MAX - C + 1
96019601
Lower = APInt::getSignedMinValue(Width);
9602-
Upper = APInt::getSignedMaxValue(Width) + *C + 2;
9602+
Upper = *C - APInt::getSignedMaxValue(Width);
96039603
} else {
96049604
// Note that sub 0, INT_MIN is not NSW. It techically is a signed wrap
96059605
// 'sub nsw C, x' produces [SINT_MIN + 1 + C, SINT_MAX].

0 commit comments

Comments
 (0)