summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-06-23 20:28:52 +0000
committerCraig Topper <craig.topper@intel.com>2017-06-23 20:28:52 +0000
commitb6609b62a4674bc4246740da7854139371b37cc7 (patch)
treea84b2a28ee7e28327b859297f25c8be9d365f1f1
parentb73646f8223018a205d9ec8513c2a2b631604015 (diff)
downloadbcm5719-llvm-b6609b62a4674bc4246740da7854139371b37cc7.tar.gz
bcm5719-llvm-b6609b62a4674bc4246740da7854139371b37cc7.zip
[APInt] Make the single word cases of isMaxSignedValue/isMinSignedValue just compare with the expected value rather than counting bits. NFCI
llvm-svn: 306155
-rw-r--r--llvm/include/llvm/ADT/APInt.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 1289335fd2a..e5f0c35534a 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -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.
OpenPOWER on IntegriCloud