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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 01:45:59 PDT 2025


================
@@ -29,6 +29,19 @@ template <typename Pattern> bool match(VPUser *U, const Pattern &P) {
   return R && match(R, P);
 }
 
+template <typename Val, typename Pattern> struct VPMatchFunctor {
+  const Pattern &P;
+  VPMatchFunctor(const Pattern &P) : P(P) {}
+  bool operator()(Val *V) const { return match(V, P); }
+};
+
+/// A match functor that can be used as a UnaryPredicate in functional
+/// algorithms like all_of.
+template <typename Val = VPUser, typename Pattern>
----------------
artagnon wrote:

Nope, it's not able to.

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


More information about the llvm-commits mailing list