mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 17:38:39 +00:00
fold nested and's early to avoid inefficiencies in MaskedValueIsZero. This
fixes a very slow compile in PR639. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a7ad198f89
commit
e9f15e538a
@ -1726,6 +1726,15 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
|
|||||||
if (AndRHS->isAllOnesValue())
|
if (AndRHS->isAllOnesValue())
|
||||||
return ReplaceInstUsesWith(I, Op0);
|
return ReplaceInstUsesWith(I, Op0);
|
||||||
|
|
||||||
|
// and (and X, c1), c2 -> and (x, c1&c2). Handle this case here, before
|
||||||
|
// calling MaskedValueIsZero, to avoid inefficient cases where we traipse
|
||||||
|
// through many levels of ands.
|
||||||
|
{
|
||||||
|
Value *X; ConstantInt *C1;
|
||||||
|
if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))))
|
||||||
|
return BinaryOperator::createAnd(X, ConstantExpr::getAnd(C1, AndRHS));
|
||||||
|
}
|
||||||
|
|
||||||
if (MaskedValueIsZero(Op0, AndRHS)) // LHS & RHS == 0
|
if (MaskedValueIsZero(Op0, AndRHS)) // LHS & RHS == 0
|
||||||
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user