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

Chris Lattner sabre at nondot.org
Thu Jun 14 22:27:17 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.769 -> 1.770
---
Log message:

delete some obviously dead vector operations, which deletes a few thousand
operations from Duraids example.


---
Diffs of the changes:  (+12 -1)

 InstructionCombining.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.769 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.770
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.769	Wed Jun  6 12:08:48 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Jun 15 00:26:55 2007
@@ -3245,8 +3245,10 @@
       return &I;
   } else {
     if (ConstantVector *CP = dyn_cast<ConstantVector>(Op1)) {
-      if (CP->isAllOnesValue())
+      if (CP->isAllOnesValue())            // X & <-1,-1> -> X
         return ReplaceInstUsesWith(I, I.getOperand(0));
+    } else if (isa<ConstantAggregateZero>(Op1)) {
+      return ReplaceInstUsesWith(I, Op1);  // X & <0,0> -> <0,0>
     }
   }
   
@@ -3714,7 +3716,14 @@
     if (SimplifyDemandedBits(&I, APInt::getAllOnesValue(BitWidth),
                              KnownZero, KnownOne))
       return &I;
+  } else if (isa<ConstantAggregateZero>(Op1)) {
+    return ReplaceInstUsesWith(I, Op0);  // X | <0,0> -> X
+  } else if (ConstantVector *CP = dyn_cast<ConstantVector>(Op1)) {
+    if (CP->isAllOnesValue())            // X | <-1,-1> -> <-1,-1>
+      return ReplaceInstUsesWith(I, I.getOperand(1));
   }
+    
+
   
   // or X, -1 == -1
   if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {
@@ -4107,6 +4116,8 @@
     if (SimplifyDemandedBits(&I, APInt::getAllOnesValue(BitWidth),
                              KnownZero, KnownOne))
       return &I;
+  } else if (isa<ConstantAggregateZero>(Op1)) {
+    return ReplaceInstUsesWith(I, Op0);  // X ^ <0,0> -> X
   }
 
   if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {






More information about the llvm-commits mailing list