From 6366ebb69b1774e6ceccb70ef062adc060ded772 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 20 Apr 2017 06:04:03 +0000 Subject: [PATCH] [APInt] In slt/sgt(uint64_t), only call getMinSignedBits if the APInt is not a single word. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300824 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/APInt.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 2e8da455c0a30..785a9afd4d8c9 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -1104,7 +1104,8 @@ class LLVM_NODISCARD APInt { /// /// \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 @@ class LLVM_NODISCARD APInt { /// /// \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