simplify these patterns using m_Specific. No need to grep for
xor in testcase (or is a substring).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60328 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 11c5f75..bc87444 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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)) {