mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Add instcombine patterns for the following transformations:
(x & y) | (x ^ y) -> x | y (x & y) + (x ^ y) -> x | y Patch by Manman Ren. rdar://10770603 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -329,6 +329,20 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for (x & y) + (x ^ y)
|
||||
{
|
||||
Value *A = 0, *B = 0;
|
||||
if (match(RHS, m_Xor(m_Value(A), m_Value(B))) &&
|
||||
(match(LHS, m_And(m_Specific(A), m_Specific(B))) ||
|
||||
match(LHS, m_And(m_Specific(B), m_Specific(A)))))
|
||||
return BinaryOperator::CreateOr(A, B);
|
||||
|
||||
if (match(LHS, m_Xor(m_Value(A), m_Value(B))) &&
|
||||
(match(RHS, m_And(m_Specific(A), m_Specific(B))) ||
|
||||
match(RHS, m_And(m_Specific(B), m_Specific(A)))))
|
||||
return BinaryOperator::CreateOr(A, B);
|
||||
}
|
||||
|
||||
return Changed ? &I : 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user