[llvm-commits] [release_20] CVS: llvm/lib/Support/APInt.cpp

Tanya Lattner tonic at nondot.org
Mon May 14 22:01:09 PDT 2007



Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.79 -> 1.79.2.1
---
Log message:

Merge from mainline.



---
Diffs of the changes:  (+6 -0)

 APInt.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.79 llvm/lib/Support/APInt.cpp:1.79.2.1
--- llvm/lib/Support/APInt.cpp:1.79	Thu May  3 13:15:36 2007
+++ llvm/lib/Support/APInt.cpp	Tue May 15 00:00:54 2007
@@ -1199,6 +1199,12 @@
   if (shiftAmt == BitWidth)
     return APInt(BitWidth, 0);
 
+  // If none of the bits are shifted out, the result is *this. This avoids a
+  // lshr by the words size in the loop below which can produce incorrect
+  // results. It also avoids the expensive computation below for a common case.
+  if (shiftAmt == 0)
+    return *this;
+
   // Create some space for the result.
   uint64_t * val = new uint64_t[getNumWords()];
 






More information about the llvm-commits mailing list