[SCEV] Use logical and/or matcher
This is a minor patch that updates ScalarEvolution::isImpliedCond to use logical and/or matcher.
This commit is contained in:
parent
27ae17a6b0
commit
b00209ed10
|
@ -10231,20 +10231,15 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
|
|||
make_scope_exit([&]() { PendingLoopPredicates.erase(FoundCondValue); });
|
||||
|
||||
// Recursively handle And and Or conditions.
|
||||
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(FoundCondValue)) {
|
||||
if (BO->getOpcode() == Instruction::And) {
|
||||
if (!Inverse)
|
||||
return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse,
|
||||
Context) ||
|
||||
isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse,
|
||||
Context);
|
||||
} else if (BO->getOpcode() == Instruction::Or) {
|
||||
if (Inverse)
|
||||
return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse,
|
||||
Context) ||
|
||||
isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse,
|
||||
Context);
|
||||
}
|
||||
const Value *Op0, *Op1;
|
||||
if (match(FoundCondValue, m_LogicalAnd(m_Value(Op0), m_Value(Op1)))) {
|
||||
if (!Inverse)
|
||||
return isImpliedCond(Pred, LHS, RHS, Op0, Inverse, Context) ||
|
||||
isImpliedCond(Pred, LHS, RHS, Op1, Inverse, Context);
|
||||
} else if (match(FoundCondValue, m_LogicalOr(m_Value(Op0), m_Value(Op1)))) {
|
||||
if (Inverse)
|
||||
return isImpliedCond(Pred, LHS, RHS, Op0, Inverse, Context) ||
|
||||
isImpliedCond(Pred, LHS, RHS, Op1, Inverse, Context);
|
||||
}
|
||||
|
||||
const ICmpInst *ICI = dyn_cast<ICmpInst>(FoundCondValue);
|
||||
|
|
Loading…
Reference in New Issue