diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-13 23:07:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-13 23:07:23 +0000 |
commit | 2082ad9b41b39e280abc20752d4ca8192e5cd16d (patch) | |
tree | 7b43bf741ed86ec26ce36fda055eaee67951caf4 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | 1f7b4e685e6ae751519c33d703d8292a117579ff (diff) |
Implement Instcombine/and.ll:test34
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d42e0bbdf9..3266ffdae3 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2439,6 +2439,18 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { 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) |