[llvm] [VPlan] Make class_match variadic, reuse for m_LiveIn. NFC (PR #178196)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 04:51:04 PST 2026
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/178196
None
>From 3ad9c774b4f346ff90631be7163a1fad3bfdfe80 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Tue, 27 Jan 2026 20:49:23 +0800
Subject: [PATCH] [VPlan] Make class_match variadic, reuse for m_LiveIn. NFC
---
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index c70a84763cf46..ba124153c6fb5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -43,8 +43,10 @@ template <typename Pattern> bool match(VPSingleDefRecipe *R, const Pattern &P) {
return P.match(static_cast<const VPRecipeBase *>(R));
}
-template <typename Class> struct class_match {
- template <typename ITy> bool match(ITy *V) const { return isa<Class>(V); }
+template <typename... Classes> struct class_match {
+ template <typename ITy> bool match(ITy *V) const {
+ return isa<Classes...>(V);
+ }
};
/// Match an arbitrary VPValue and ignore it.
@@ -959,13 +961,7 @@ m_Intrinsic(const T0 &Op0, const T1 &Op1, const T2 &Op2, const T3 &Op3) {
return m_CombineAnd(m_Intrinsic<IntrID>(Op0, Op1, Op2), m_Argument<3>(Op3));
}
-struct live_in_vpvalue {
- template <typename ITy> bool match(ITy *V) const {
- return isa<VPIRValue, VPSymbolicValue>(V);
- }
-};
-
-inline live_in_vpvalue m_LiveIn() { return live_in_vpvalue(); }
+inline auto m_LiveIn() { return class_match<VPIRValue, VPSymbolicValue>(); }
/// Match a GEP recipe (VPWidenGEPRecipe, VPInstruction, or VPReplicateRecipe)
/// and bind the source element type and operands.
More information about the llvm-commits
mailing list