[llvm] [VPlan] Introduce m_ICmp matcher (PR #151540)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 3 18:52:34 PDT 2025


================
@@ -1420,11 +1419,10 @@ static bool isConditionTrueViaVFAndUF(VPValue *Cond, VPlan &Plan,
     });
 
   auto *CanIV = Plan.getCanonicalIV();
-  if (!match(Cond, m_Binary<Instruction::ICmp>(
-                       m_Specific(CanIV->getBackedgeValue()),
-                       m_Specific(&Plan.getVectorTripCount()))) ||
-      cast<VPRecipeWithIRFlags>(Cond->getDefiningRecipe())->getPredicate() !=
-          CmpInst::ICMP_EQ)
+  CmpPredicate Pred;
+  if (!match(Cond, m_ICmp(Pred, m_Specific(CanIV->getBackedgeValue()),
+                          m_Specific(&Plan.getVectorTripCount()))) ||
+      Pred != CmpInst::ICMP_EQ)
----------------
lukel97 wrote:

Should we instead be implementing `m_SpecificICmp` from regular LLVM IR pattern patch so we don't need to bind to a temporary?

https://github.com/llvm/llvm-project/pull/151540


More information about the llvm-commits mailing list