[llvm] [LoopVectorize] Use CodeSize as the cost kind for minsize (PR #124119)

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 09:17:03 PST 2025


================
@@ -5506,7 +5515,8 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
       }
 
     // Scale the total scalar cost by block probability.
-    ScalarCost /= getReciprocalPredBlockProb();
+    if (CostKind != TTI::TCK_CodeSize)
----------------
john-brawn-arm wrote:

I haven't been able to come up with a test to specifically test this, as any test I come up with the cost is large enough that incorrectly halving it doesn't matter because it's still larger than the scalar cost. If getReciprocalPredBlockProb used the actual block probability, instead of assuming it's 0.5 as it currently does, then I could probably do it by setting the block probability to close to zero.

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


More information about the llvm-commits mailing list