summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-20 06:04:03 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-20 06:04:03 +0000
commit6a638427084577d9ea6570c2da74d20839a4baa0 (patch)
treefbd1c016fdf98c3d12887033f2affcf144ab8038
parentfded30584e4cb332f6a114311dfbd7133dc07b8f (diff)
downloadbcm5719-llvm-6a638427084577d9ea6570c2da74d20839a4baa0.tar.gz
bcm5719-llvm-6a638427084577d9ea6570c2da74d20839a4baa0.zip
[APInt] In slt/sgt(uint64_t), only call getMinSignedBits if the APInt is not a single word.
llvm-svn: 300824
-rw-r--r--llvm/include/llvm/ADT/APInt.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 2e8da455c0a..785a9afd4d8 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -1104,7 +1104,8 @@ public:
///
/// \returns true if *this < RHS when considered signed.
bool slt(int64_t RHS) const {
- return getMinSignedBits() > 64 ? isNegative() : getSExtValue() < RHS;
+ return (!isSingleWord() && getMinSignedBits() > 64) ? isNegative()
+ : getSExtValue() < RHS;
}
/// \brief Unsigned less or equal comparison
@@ -1173,7 +1174,8 @@ public:
///
/// \returns true if *this > RHS when considered signed.
bool sgt(int64_t RHS) const {
- return getMinSignedBits() > 64 ? !isNegative() : getSExtValue() > RHS;
+ return (!isSingleWord() && getMinSignedBits() > 64) ? !isNegative()
+ : getSExtValue() > RHS;
}
/// \brief Unsigned greater or equal comparison
OpenPOWER on IntegriCloud