[llvm] [VPlan] Don't apply predication discount to non-originally-predicated blocks (PR #160449)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 02:46:18 PDT 2025


================
@@ -5088,7 +5108,7 @@ InstructionCost LoopVectorizationCostModel::expectedCost(ElementCount VF) {
     // cost by the probability of executing it. blockNeedsPredication from
     // Legal is used so as to not include all blocks in tail folded loops.
     if (VF.isScalar() && Legal->blockNeedsPredication(BB))
-      BlockCost /= getPredBlockCostDivisor(CostKind);
+      BlockCost /= getPredBlockCostDivisor(CostKind, BB);
----------------
lukel97 wrote:

Oh good point. And I guess that comment above confirms that the predication discount isn't meant to be applied to tail folded blocks? ab97c9bdb747c873cd35a18229e2694156a7607d



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


More information about the llvm-commits mailing list