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

Chris Lattner sabre at nondot.org
Sat Mar 24 16:57:00 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.683 -> 1.684
---
Log message:

fix a regression on vector or instructions.


---
Diffs of the changes:  (+9 -9)

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


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.683 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.684
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.683	Sat Mar 24 10:34:37 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sat Mar 24 18:56:43 2007
@@ -3636,9 +3636,8 @@
   bool Changed = SimplifyCommutative(I);
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
 
-  if (isa<UndefValue>(Op1))
-    return ReplaceInstUsesWith(I,                         // X | undef -> -1
-                               ConstantInt::getAllOnesValue(I.getType()));
+  if (isa<UndefValue>(Op1))                       // X | undef -> -1
+    return ReplaceInstUsesWith(I, ConstantInt::getAllOnesValue(I.getType()));
 
   // or X, X = X
   if (Op0 == Op1)
@@ -3646,12 +3645,13 @@
 
   // See if we can simplify any instructions used by the instruction whose sole 
   // purpose is to compute bits we don't care about.
-  uint32_t BitWidth = cast<IntegerType>(I.getType())->getBitWidth();
-  APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
-  if (!isa<VectorType>(I.getType()) &&
-      SimplifyDemandedBits(&I, APInt::getAllOnesValue(BitWidth),
-                           KnownZero, KnownOne))
-    return &I;
+  if (!isa<VectorType>(I.getType())) {
+    uint32_t BitWidth = cast<IntegerType>(I.getType())->getBitWidth();
+    APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
+    if (SimplifyDemandedBits(&I, APInt::getAllOnesValue(BitWidth),
+                             KnownZero, KnownOne))
+      return &I;
+  }
   
   // or X, -1 == -1
   if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {






More information about the llvm-commits mailing list