[llvm] [VectorCombine] Refine cost model and decision logic in foldSelectShuffle (PR #146694)
    Igor Kirillov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jul 23 10:02:56 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 ||
----------------
igogo-x86 wrote:
I swear I saw a failing test with CotBefore equal to zero, but it doesn't trigger anymore
https://github.com/llvm/llvm-project/pull/146694
    
    
More information about the llvm-commits
mailing list