mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Added InstCombine for "select cond, ~cond, x" type patterns
These can be reduced to "~cond & x" or "~cond | x" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146624 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -682,6 +682,13 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return BinaryOperator::CreateOr(CondVal, FalseVal);
|
||||
else if (CondVal == FalseVal)
|
||||
return BinaryOperator::CreateAnd(CondVal, TrueVal);
|
||||
|
||||
// select a, ~a, b -> (~a)&b
|
||||
// select a, b, ~a -> (~a)|b
|
||||
if (match(TrueVal, m_Not(m_Specific(CondVal))))
|
||||
return BinaryOperator::CreateAnd(TrueVal, FalseVal);
|
||||
else if (match(FalseVal, m_Not(m_Specific(CondVal))))
|
||||
return BinaryOperator::CreateOr(TrueVal, FalseVal);
|
||||
}
|
||||
|
||||
// Selecting between two integer constants?
|
||||
|
Reference in New Issue
Block a user