[llvm] [VPlanPatternMatch] Introduce match functor (NFC) (PR #159521)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 01:48:17 PDT 2025


================
@@ -6901,11 +6901,12 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
       // Unused FOR splices are removed by VPlan transforms, so the VPlan-based
       // cost model won't cost it whilst the legacy will.
       if (auto *FOR = dyn_cast<VPFirstOrderRecurrencePHIRecipe>(&R)) {
-        if (none_of(FOR->users(), [](VPUser *U) {
-              auto *VPI = dyn_cast<VPInstruction>(U);
-              return VPI && VPI->getOpcode() ==
-                                VPInstruction::FirstOrderRecurrenceSplice;
-            }))
+        using namespace VPlanPatternMatch;
+        if (none_of(
+                FOR->users(),
+                match_fn(
+                    m_VPInstruction<VPInstruction::FirstOrderRecurrenceSplice>(
+                        m_VPValue(), m_VPValue()))))
----------------
fhahn wrote:

for use cases such as this, it would be convenient if we could match w/o arguments, just the opcode, as this is now less compact

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


More information about the llvm-commits mailing list