Skip to content

Commit 9333bc6

Browse files
committed
[VPlan] Implement SpecificICmp_match in terms of ICmp_match
1 parent b9355fe commit 9333bc6

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,8 @@ template <typename Op0_t, typename Op1_t> struct ICmp_match {
487487
}
488488
};
489489

490-
/// SpecificICmp_match is a variant of BinaryRecipe_match that also matches the
491-
/// comparison predicate.
490+
/// SpecificICmp_match is a variant of ICmp_match that matches the comparison
491+
/// predicate, instead of binding it.
492492
template <typename Op0_t, typename Op1_t> struct SpecificICmp_match {
493493
const CmpPredicate Predicate;
494494
Op0_t Op0;
@@ -498,14 +498,9 @@ template <typename Op0_t, typename Op1_t> struct SpecificICmp_match {
498498
: Predicate(Pred), Op0(LHS), Op1(RHS) {}
499499

500500
bool match(const VPValue *V) const {
501-
auto *DefR = V->getDefiningRecipe();
502-
return DefR && match(DefR);
503-
}
504-
505-
bool match(const VPRecipeBase *V) const {
506-
return m_Binary<Instruction::ICmp>(Op0, Op1).match(V) &&
507-
CmpPredicate::getMatching(
508-
cast<VPRecipeWithIRFlags>(V)->getPredicate(), Predicate);
501+
CmpPredicate CurrentPred;
502+
return ICmp_match<Op0_t, Op1_t>(CurrentPred, Op0, Op1).match(V) &&
503+
CmpPredicate::getMatching(CurrentPred, Predicate);
509504
}
510505
};
511506

0 commit comments

Comments
 (0)