[llvm] c245774 - [VPlan] Make class_match variadic, reuse for m_LiveIn. NFC (#178196)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 05:22:55 PST 2026
Author: Luke Lau
Date: 2026-01-27T21:22:51+08:00
New Revision: c2457742c0023e1d9ff8a0f7dd154e58e265fe0c
URL: https://github.com/llvm/llvm-project/commit/c2457742c0023e1d9ff8a0f7dd154e58e265fe0c
DIFF: https://github.com/llvm/llvm-project/commit/c2457742c0023e1d9ff8a0f7dd154e58e265fe0c.diff
LOG: [VPlan] Make class_match variadic, reuse for m_LiveIn. NFC (#178196)
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
Removed:
################################################################################
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