[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 07:15:49 PST 2025


================
@@ -793,7 +793,7 @@ InstructionCost VPRegionBlock::cost(ElementCount VF, VPCostContext &Ctx) {
 
   // For the scalar case, we may not always execute the original predicated
   // block, Thus, scale the block's cost by the probability of executing it.
-  if (VF.isScalar())
+  if (VF.isScalar() && Ctx.CostKind != TTI::TCK_CodeSize)
     return ThenCost / getReciprocalPredBlockProb();
----------------
john-brawn-arm wrote:

Possibly, though then it wouldn't be "reciprocal predicated block probability" but rather "how much this block should contribute to the cost calculation".

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


More information about the llvm-commits mailing list