diff options
author | Dale Johannesen <dalej@apple.com> | 2009-08-12 17:42:34 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-08-12 17:42:34 +0000 |
commit | 34c08bbbf97ef5672c8c955f9b31549be0d83eff (patch) | |
tree | 0cba8e5073303c9fadf0b2fb607f1a1615691f66 /llvm/lib | |
parent | cecfe61cd1a95fdfc2a9256e1ca23d1079a2305a (diff) | |
download | bcm5719-llvm-34c08bbbf97ef5672c8c955f9b31549be0d83eff.tar.gz bcm5719-llvm-34c08bbbf97ef5672c8c955f9b31549be0d83eff.zip |
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.
llvm-svn: 78821
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index a034fd1e797..6638fccfef5 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -897,10 +897,10 @@ double APInt::roundToDouble(bool isSigned) const { // 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. |