[llvm-commits] [llvm] r78821 - /llvm/trunk/lib/Support/APInt.cpp

Dale Johannesen dalej at apple.com
Wed Aug 12 10:42:34 PDT 2009


Author: johannes
Date: Wed Aug 12 12:42:34 2009
New Revision: 78821

URL: http://llvm.org/viewvc/llvm-project?rev=78821&view=rev
Log:
Fix a nondeterministic bug in APInt::roundToDouble;
when !isSingleWord() but getActiveBits() is small,
we were using the pointer value instead of the low
word of the integer value.


Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=78821&r1=78820&r2=78821&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Wed Aug 12 12:42:34 2009
@@ -897,10 +897,10 @@
   // Handle the simple case where the value is contained in one uint64_t.
   if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
     if (isSigned) {
-      int64_t sext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth);
+      int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth);
       return double(sext);
     } else
-      return double(VAL);
+      return double(getWord(0));
   }
 
   // Determine if the value is negative.





More information about the llvm-commits mailing list