[llvm] [VPlan] Use parameter packs to avoid unary/binary/ternary matchers. NFC (PR #152272)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 00:51:51 PDT 2025
================
@@ -270,251 +265,177 @@ struct Recipe_match {
}
};
-template <unsigned Opcode, typename... RecipeTys>
-using ZeroOpRecipe_match =
- Recipe_match<std::tuple<>, Opcode, false, RecipeTys...>;
-
-template <typename Op0_t, unsigned Opcode, typename... RecipeTys>
-using UnaryRecipe_match =
- Recipe_match<std::tuple<Op0_t>, Opcode, false, RecipeTys...>;
-
-template <typename Op0_t, unsigned Opcode>
-using UnaryVPInstruction_match =
- UnaryRecipe_match<Op0_t, Opcode, VPInstruction>;
+template <unsigned Opcode, typename... OpTys>
+using AllRecipe_match =
+ Recipe_match<std::tuple<OpTys...>, Opcode, false, VPWidenRecipe,
+ VPReplicateRecipe, VPWidenCastRecipe, VPInstruction,
+ VPWidenSelectRecipe>;
-template <unsigned Opcode>
-using ZeroOpVPInstruction_match = ZeroOpRecipe_match<Opcode, VPInstruction>;
+template <unsigned Opcode, typename... OpTys>
+using AllRecipe_commutative_match =
+ Recipe_match<std::tuple<OpTys...>, Opcode, true, VPWidenRecipe,
+ VPReplicateRecipe, VPInstruction>;
-template <typename Op0_t, unsigned Opcode>
-using AllUnaryRecipe_match =
- UnaryRecipe_match<Op0_t, Opcode, VPWidenRecipe, VPReplicateRecipe,
- VPWidenCastRecipe, VPInstruction>;
+template <unsigned Opcode, typename... OpTys>
+using VPInstruction_match = Recipe_match<std::tuple<OpTys...>, Opcode,
----------------
david-arm wrote:
Do we not need both commutative and non-commutative variants? We use VPInstruction types for normal IR opcodes too, such as add, mul, etc. which are commutative.
https://github.com/llvm/llvm-project/pull/152272
More information about the llvm-commits
mailing list