[APInt] Make the single word cases of isMaxSignedValue/isMinSignedValue just compare with the expected value rather than counting bits. NFCI

llvm-svn: 306155
This commit is contained in:
Craig Topper 2017-06-23 20:28:52 +00:00
parent b73646f822
commit b6609b62a4
1 changed files with 6 additions and 2 deletions

View File

@ -414,7 +414,9 @@ public:
/// This checks to see if the value of this APInt is the maximum signed
/// value for the APInt's bit width.
bool isMaxSignedValue() const {
return !isNegative() && countTrailingOnes() == BitWidth - 1;
if (isSingleWord())
return U.VAL == ((WordType(1) << (BitWidth - 1)) - 1);
return !isNegative() && countTrailingOnesSlowCase() == BitWidth - 1;
}
/// \brief Determine if this is the smallest unsigned value.
@ -428,7 +430,9 @@ public:
/// This checks to see if the value of this APInt is the minimum signed
/// value for the APInt's bit width.
bool isMinSignedValue() const {
return isNegative() && countTrailingZeros() == BitWidth - 1;
if (isSingleWord())
return U.VAL == (WordType(1) << (BitWidth - 1));
return isNegative() && countTrailingZerosSlowCase() == BitWidth - 1;
}
/// \brief Check if this APInt has an N-bits unsigned integer value.