[llvm] [VPlan] Simplify select !c, x, y -> select c, y, x (PR #147268)
    Luke Lau via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Jul  8 00:55:50 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) {
----------------
lukel97 wrote:
> as it's clearer and doesn't require creating a constant.
Yeah I just ran into this, trying to create a constant in VPBuilder is quite tricky since it requires a) access to the VPlan b) inferring the type of the constant to be materialised
https://github.com/llvm/llvm-project/pull/147268
    
    
More information about the llvm-commits
mailing list