Skip to content

Commit b28f157

Browse files
AZero13dtcxzyw
andauthored
Suggested Change
Co-authored-by: Yingwei Zheng <[email protected]>
1 parent b0e78b7 commit b28f157

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9603,8 +9603,8 @@ static void setLimitsForBinOp(const BinaryOperator &BO, APInt &Lower,
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].
9606-
Lower = APInt::getSignedMinValue(Width) + *C + 1;
9607-
Upper = APInt::getSignedMaxValue(Width) + 1;
9606+
Lower = *C - APInt::getSignedMaxValue(Width);
9607+
Upper = APInt::getSignedMinValue(Width);
96089608
}
96099609
}
96109610
}

0 commit comments

Comments
 (0)