[APInt] In slt/sgt(uint64_t), only call getMinSignedBits if the APInt is not a single...
authorCraig Topper <craig.topper@gmail.com>
Thu, 20 Apr 2017 06:04:03 +0000 (06:04 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 20 Apr 2017 06:04:03 +0000 (06:04 +0000)
llvm-svn: 300824

llvm/include/llvm/ADT/APInt.h

index 2e8da45..785a9af 100644 (file)
@@ -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