@@ -10231,20 +10231,15 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
10231
10231
make_scope_exit([&]() { PendingLoopPredicates.erase(FoundCondValue); });
10232
10232
10233
10233
// Recursively handle And and Or conditions.
10234
- if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(FoundCondValue)) {
10235
- if (BO->getOpcode() == Instruction::And) {
10236
- if (!Inverse)
10237
- return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse,
10238
- Context) ||
10239
- isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse,
10240
- Context);
10241
- } else if (BO->getOpcode() == Instruction::Or) {
10242
- if (Inverse)
10243
- return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse,
10244
- Context) ||
10245
- isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse,
10246
- Context);
10247
- }
10234
+ const Value *Op0, *Op1;
10235
+ if (match(FoundCondValue, m_LogicalAnd(m_Value(Op0), m_Value(Op1)))) {
10236
+ if (!Inverse)
10237
+ return isImpliedCond(Pred, LHS, RHS, Op0, Inverse, Context) ||
10238
+ isImpliedCond(Pred, LHS, RHS, Op1, Inverse, Context);
10239
+ } else if (match(FoundCondValue, m_LogicalOr(m_Value(Op0), m_Value(Op1)))) {
10240
+ if (Inverse)
10241
+ return isImpliedCond(Pred, LHS, RHS, Op0, Inverse, Context) ||
10242
+ isImpliedCond(Pred, LHS, RHS, Op1, Inverse, Context);
10248
10243
}
10249
10244
10250
10245
const ICmpInst *ICI = dyn_cast<ICmpInst>(FoundCondValue);
0 commit comments