summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-19 23:57:51 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-19 23:57:51 +0000
commitb3624e4f4561d7b8d0801e2d0c034049f5375283 (patch)
tree9bdeb98d57b4f2fe4bb2557a1c824271d7309f3e
parent0e7f6fb6b418952e558b8b56ebd8655b133919ec (diff)
downloadbcm5719-llvm-b3624e4f4561d7b8d0801e2d0c034049f5375283.tar.gz
bcm5719-llvm-b3624e4f4561d7b8d0801e2d0c034049f5375283.zip
[APInt] Implement operator==(uint64_t) similar to ugt/ult(uint64_t) to remove one of the out of line EqualsSlowCase methods.
llvm-svn: 300799
-rw-r--r--llvm/include/llvm/ADT/APInt.h7
-rw-r--r--llvm/lib/Support/APInt.cpp8
2 files changed, 1 insertions, 14 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 1eff4b69b2d..b87cf89bba5 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -200,9 +200,6 @@ private:
/// out-of-line slow case for operator==
bool EqualSlowCase(const APInt &RHS) const LLVM_READONLY;
- /// out-of-line slow case for operator==
- bool EqualSlowCase(uint64_t Val) const LLVM_READONLY;
-
/// out-of-line slow case for countLeadingZeros
unsigned countLeadingZerosSlowCase() const LLVM_READONLY;
@@ -1031,9 +1028,7 @@ public:
///
/// \returns true if *this == Val
bool operator==(uint64_t Val) const {
- if (isSingleWord())
- return VAL == Val;
- return EqualSlowCase(Val);
+ return (isSingleWord() || getActiveBits() <= 64) && getZExtValue() == Val;
}
/// \brief Equality comparison.
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index ad964e2f3c8..805a912501d 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -364,14 +364,6 @@ bool APInt::EqualSlowCase(const APInt& RHS) const {
return std::equal(pVal, pVal + getNumWords(), RHS.pVal);
}
-bool APInt::EqualSlowCase(uint64_t Val) const {
- unsigned n = getActiveBits();
- if (n <= APINT_BITS_PER_WORD)
- return pVal[0] == Val;
- else
- return false;
-}
-
bool APInt::ult(const APInt& RHS) const {
assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
if (isSingleWord())
OpenPOWER on IntegriCloud