mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
This patch implements transform for pattern "( A & (~B)) | (A ^ B) -> (A ^ B)"
Differential Revision: http://reviews.llvm.org/D4652 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214477 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2010,6 +2010,16 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
|
||||
match(Op1, m_Not(m_Specific(A))))
|
||||
return BinaryOperator::CreateOr(Builder->CreateNot(A), B);
|
||||
|
||||
// (A & (~B)) | (A ^ B) -> (A ^ B)
|
||||
if (match(Op0, m_And(m_Value(A), m_Not(m_Value(B)))) &&
|
||||
match(Op1, m_Xor(m_Specific(A), m_Specific(B))))
|
||||
return BinaryOperator::CreateXor(A, B);
|
||||
|
||||
// (A ^ B) | ( A & (~B)) -> (A ^ B)
|
||||
if (match(Op0, m_Xor(m_Value(A), m_Value(B))) &&
|
||||
match(Op1, m_And(m_Specific(A), m_Not(m_Specific(B)))))
|
||||
return BinaryOperator::CreateXor(A, B);
|
||||
|
||||
// (A & C)|(B & D)
|
||||
Value *C = nullptr, *D = nullptr;
|
||||
if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
|
||||
|
Reference in New Issue
Block a user