[llvm] r300747 - [APInt] Use SignExtend64 instead of reinventing it. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 13:32:11 PDT 2017


Author: ctopper
Date: Wed Apr 19 15:32:11 2017
New Revision: 300747

URL: http://llvm.org/viewvc/llvm-project?rev=300747&view=rev
Log:
[APInt] Use SignExtend64 instead of reinventing it. NFC

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=300747&r1=300746&r2=300747&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Wed Apr 19 15:32:11 2017
@@ -1433,8 +1433,7 @@ public:
   /// int64_t. Otherwise an assertion will result.
   int64_t getSExtValue() const {
     if (isSingleWord())
-      return int64_t(VAL << (APINT_BITS_PER_WORD - BitWidth)) >>
-             (APINT_BITS_PER_WORD - BitWidth);
+      return SignExtend64(VAL, BitWidth);
     assert(getMinSignedBits() <= 64 && "Too many bits for int64_t");
     return int64_t(pVal[0]);
   }




More information about the llvm-commits mailing list