[llvm] [VPlan] Introduce m_c_Logical(And|Or) (NFC) (PR #180048)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 06:11:04 PST 2026


================
@@ -791,14 +802,27 @@ m_Select(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2) {
 }
 
 template <typename Op0_t>
-inline match_combine_or<VPInstruction_match<VPInstruction::Not, Op0_t>,
-                        AllRecipe_commutative_match<
-                            Instruction::Xor, int_pred_ty<is_all_ones>, Op0_t>>
-m_Not(const Op0_t &Op0) {
+using Not_match =
+    match_combine_or<VPInstruction_match<VPInstruction::Not, Op0_t>,
+                     AllRecipe_commutative_match<
+                         Instruction::Xor, int_pred_ty<is_all_ones>, Op0_t>>;
+
+template <typename Op0_t> inline Not_match<Op0_t> m_Not(const Op0_t &Op0) {
   return m_CombineOr(m_VPInstruction<VPInstruction::Not>(Op0),
                      m_c_Binary<Instruction::Xor>(m_AllOnes(), Op0));
 }
 
+template <typename Op0_t, typename Op1_t, typename Op2_t>
+using Select_commutative_match = match_combine_or<
+    AllRecipe_match<Instruction::Select, Op0_t, Op1_t, Op2_t>,
+    AllRecipe_match<Instruction::Select, Not_match<Op0_t>, Op2_t, Op1_t>>;
+
+template <typename Op0_t, typename Op1_t, typename Op2_t>
+inline Select_commutative_match<Op0_t, Op1_t, Op2_t>
----------------
lukel97 wrote:

At this point should we just start using auto? I think these types are complex enough to warrant the use by LLVM coding standards
```suggestion
inline auto
```

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


More information about the llvm-commits mailing list