[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Mon Mar 19 14:08:24 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.665 -> 1.666
---
Log message:

Implement isMinValuePlusOne using facilities of APInt instead of uint64_t
Patch by Zhou Sheng.


---
Diffs of the changes:  (+4 -5)

 InstructionCombining.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.666
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.665	Mon Mar 19 16:04:43 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Mar 19 16:08:07 2007
@@ -3463,12 +3463,11 @@
 static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
   if (isSigned) {
     // Calculate 1111111111000000000000
-    unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
-    int64_t Val = -1;                    // All ones
-    Val <<= TypeBits-1;                  // Shift over to the right spot
-    return C->getSExtValue() == Val+1;
+    uint32_t TypeBits = C->getType()->getPrimitiveSizeInBits();
+    APInt Val(APInt::getSignedMinValue(TypeBits));
+    return C->getValue() == Val+1;
   }
-  return C->getZExtValue() == 1; // unsigned
+  return C->getValue() == 1; // unsigned
 }
 
 // isOneBitSet - Return true if there is exactly one bit set in the specified






More information about the llvm-commits mailing list