[llvm] [VPlan] Simplify select !c, x, y -> select c, y, x (PR #147268)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 03:22:16 PDT 2025


================
@@ -491,6 +485,15 @@ m_Select(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2) {
       {Op0, Op1, Op2});
 }
 
+template <typename Op0_t>
+inline match_combine_or<UnaryVPInstruction_match<Op0_t, VPInstruction::Not>,
+                        AllBinaryRecipe_match<int_pred_ty<is_all_ones>, Op0_t,
+                                              Instruction::Xor, true>>
+m_Not(const Op0_t &Op0) {
+  return m_CombineOr(m_VPInstruction<VPInstruction::Not>(Op0),
+                     m_c_Binary<Instruction::Xor>(m_AllOnes(), Op0));
----------------
artagnon wrote:

Perhaps factor out an m_c_Xor?

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


More information about the llvm-commits mailing list