diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-20 15:20:01 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-20 15:20:01 +0000 |
commit | 5b7a4e01952ee454392243496b0577ef2496ed37 (patch) | |
tree | a177d048facddab26b41956c43f20e693616b0e6 /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | d5d7f37beb9f561b70fa31ee89efd2dad5b60be5 (diff) | |
download | bcm5719-llvm-5b7a4e01952ee454392243496b0577ef2496ed37.tar.gz bcm5719-llvm-5b7a4e01952ee454392243496b0577ef2496ed37.zip |
Move "A | ~(A & ?) -> -1" from InstCombine to InstructionSimplify.
llvm-svn: 126082
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index a2f9862383f..982dacb50bf 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -1161,6 +1161,16 @@ static Value *SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD, (A == Op0 || B == Op0)) return Op0; + // ~(A & ?) | A = -1 + if (match(Op0, m_Not(m_And(m_Value(A), m_Value(B)))) && + (A == Op1 || B == Op1)) + return Constant::getAllOnesValue(Op1->getType()); + + // A | ~(A & ?) = -1 + if (match(Op1, m_Not(m_And(m_Value(A), m_Value(B)))) && + (A == Op0 || B == Op0)) + return Constant::getAllOnesValue(Op0->getType()); + // Try some generic simplifications for associative operations. if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, TD, DT, MaxRecurse)) |