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

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 13 15:07:34 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.434 -> 1.435
---
Log message:

Implement Instcombine/and.ll:test34


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

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


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.434 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.435
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.434	Mon Feb 13 16:41:07 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Feb 13 17:07:23 2006
@@ -2439,6 +2439,18 @@
     InsertNewInstBefore(Or, I);
     return BinaryOperator::createNot(Or);
   }
+  
+  {
+    Value *A = 0, *B = 0;
+    ConstantInt *C1 = 0, *C2 = 0;
+    if (match(Op0, m_Or(m_Value(A), m_Value(B))))
+      if (A == Op1 || B == Op1)    // (A | ?) & A  --> A
+        return ReplaceInstUsesWith(I, Op1);
+    if (match(Op1, m_Or(m_Value(A), m_Value(B))))
+      if (A == Op0 || B == Op0)    // A & (A | ?)  --> A
+        return ReplaceInstUsesWith(I, Op0);
+  }
+  
 
   if (SetCondInst *RHS = dyn_cast<SetCondInst>(Op1)) {
     // (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B)






More information about the llvm-commits mailing list