[llvm-commits] [llvm] r60328 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/and-not-or.ll
Chris Lattner
sabre at nondot.org
Sun Nov 30 21:16:26 PST 2008
Author: lattner
Date: Sun Nov 30 23:16:26 2008
New Revision: 60328
URL: http://llvm.org/viewvc/llvm-project?rev=60328&view=rev
Log:
simplify these patterns using m_Specific. No need to grep for
xor in testcase (or is a substring).
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/test/Transforms/InstCombine/and-not-or.ll
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=60328&r1=60327&r2=60328&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Nov 30 23:16:26 2008
@@ -3980,22 +3980,12 @@
}
// (A&((~A)|B)) -> A&B
- if (match(Op0, m_Or(m_Not(m_Value(A)), m_Value(B)))) {
- if (A == Op1)
- return BinaryOperator::CreateAnd(A, B);
- }
- if (match(Op0, m_Or(m_Value(A), m_Not(m_Value(B))))) {
- if (B == Op1)
- return BinaryOperator::CreateAnd(A, B);
- }
- if (match(Op1, m_Or(m_Not(m_Value(A)), m_Value(B)))) {
- if (A == Op0)
- return BinaryOperator::CreateAnd(A, B);
- }
- if (match(Op1, m_Or(m_Value(A), m_Not(m_Value(B))))) {
- if (B == Op0)
- return BinaryOperator::CreateAnd(A, B);
- }
+ if (match(Op0, m_Or(m_Not(m_Specific(Op1)), m_Value(A))) ||
+ match(Op0, m_Or(m_Value(A), m_Not(m_Specific(Op1)))))
+ return BinaryOperator::CreateAnd(A, Op1);
+ if (match(Op1, m_Or(m_Not(m_Specific(Op0)), m_Value(A))) ||
+ match(Op1, m_Or(m_Value(A), m_Not(m_Specific(Op0)))))
+ return BinaryOperator::CreateAnd(A, Op0);
}
if (ICmpInst *RHS = dyn_cast<ICmpInst>(Op1)) {
Modified: llvm/trunk/test/Transforms/InstCombine/and-not-or.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and-not-or.ll?rev=60328&r1=60327&r2=60328&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and-not-or.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and-not-or.ll Sun Nov 30 23:16:26 2008
@@ -1,6 +1,4 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %y, %x} | count 2
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %x, %y} | count 2
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %x, %y} | count 4
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or}
define i32 @func1(i32 %x, i32 %y) nounwind {
More information about the llvm-commits
mailing list