[llvm] [DAGCombine] Count leading ones: refine post DAG/Type Legalisation if promotion (PR #102877)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 09:21:44 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());
----------------
mshockwave wrote:

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

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


More information about the llvm-commits mailing list