Skip to content

Commit 99c0c6c

Browse files
committed
Fix comments
1 parent b0904ca commit 99c0c6c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9594,15 +9594,12 @@ static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
95949594
Upper = *C + 1;
95959595
} else if (HasNSW) {
95969596
if (C->isNegative()) {
9597-
// 'sub nsw -C, x' produces [SINT_MIN, SINT_MAX - (C - 1)].
9598-
// Because to be negative, C must be - 1, and the highest result is
9599-
// INT_MIN, so -INT_MIN - 1 is INT_MAX, so it is SINT_MAX - (C - 1),
9600-
// or SINT_MAX - C + 1
9597+
// 'sub nsw -C, x' produces [SINT_MIN, -C - SINT_MIN].
96019598
Lower = APInt::getSignedMinValue(Width);
96029599
Upper = *C - APInt::getSignedMaxValue(Width);
96039600
} else {
96049601
// Note that sub 0, INT_MIN is not NSW. It techically is a signed wrap
9605-
// 'sub nsw C, x' produces [SINT_MIN + 1 + C, SINT_MAX].
9602+
// 'sub nsw C, x' produces [C - SINT_MAX, SINT_MAX].
96069603
Lower = *C - APInt::getSignedMaxValue(Width);
96079604
Upper = APInt::getSignedMinValue(Width);
96089605
}

0 commit comments

Comments
 (0)