[llvm] [VectorCombine] Refine cost model and decision logic in foldSelectShuffle (PR #146694)
    David Green via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Jul 20 14:45:39 PDT 2025
    
    
  
================
@@ -3326,7 +3433,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
   LLVM_DEBUG(dbgs() << "Found a binop select shuffle pattern: " << I << "\n");
   LLVM_DEBUG(dbgs() << "  CostBefore: " << CostBefore
                     << " vs CostAfter: " << CostAfter << "\n");
-  if (CostBefore <= CostAfter)
+  if (CostBefore < CostAfter || CostBefore == 0 ||
+      (CostBefore == CostAfter && !feedsIntoVectorReduction(SVI)))
----------------
davemgreen wrote:
Could this use the FromReduction flag?
https://github.com/llvm/llvm-project/pull/146694
    
    
More information about the llvm-commits
mailing list