[llvm] [VPlan] Add commutative binary OR matcher, use in transform. (PR #92539)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 10:37:45 PDT 2024


================
@@ -268,10 +274,23 @@ m_Mul(const Op0_t &Op0, const Op1_t &Op1) {
   return m_Binary<Instruction::Mul, Op0_t, Op1_t>(Op0, Op1);
 }
 
+template <typename Op0_t, typename Op1_t, bool Commutative = false>
+inline AllBinaryRecipe_match<Op0_t, Op1_t, Instruction::Or, Commutative>
+m_BinaryOr(const Op0_t &Op0, const Op1_t &Op1) {
+  return m_Binary<Instruction::Or, Op0_t, Op1_t, Commutative>(Op0, Op1);
+}
+
+template <typename Op0_t, typename Op1_t>
+inline AllBinaryRecipe_match<Op0_t, Op1_t, Instruction::Or,
+                             /*Commutative*/ true>
+m_c_BinaryOr(const Op0_t &Op0, const Op1_t &Op1) {
----------------
fhahn wrote:

Yes, this is like in the IR based pattern matcher.

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


More information about the llvm-commits mailing list