[llvm] SD Pattern Match: Operands patterns with VP Context (PR #103308)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 09:51:19 PDT 2024


================
@@ -390,7 +392,8 @@ template <unsigned OpIdx, typename... OpndPreds> struct Operands_match {
   template <typename MatchContext>
   bool match(const MatchContext &Ctx, SDValue N) {
     // Returns false if there are more operands than predicates;
-    return N->getNumOperands() == OpIdx;
+    // Ignores the last two operands if both the Context and the Node are VP
+    return N->getNumOperands() == (OpIdx + 2 * Ctx.IsVP * N->isVPOpcode());
----------------
v01dXYZ wrote:

**mshockwave**: https://github.com/llvm/llvm-project/pull/102877#discussion_r1715577264

> readability: maybe something like Ctx.IsVP && N->isVPOpcode() ? OpIdx + 2 : OpIdx


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


More information about the llvm-commits mailing list