[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:49:20 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:

I've removed the redundant `Legal->blockNeedsPredication(BB)` in cf6b43532792f46850c158c54c9dc28c912b7148 and updated the comment. I figured we're going to need to plumb through the basic block anyway in #158690 so we might as well do it in this PR

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


More information about the llvm-commits mailing list