[llvm] [VPlan] Don't apply predication discount to non-originally-predicated blocks (PR #160449)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 01:51:47 PDT 2025
================
@@ -855,7 +855,9 @@ 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())
- return ThenCost / getPredBlockCostDivisor(Ctx.CostKind);
+ if (auto *VPIRBB = dyn_cast<VPIRBasicBlock>(Then))
----------------
fhahn wrote:
The code here is dead, we don't compute the scalar cost in VPlan currently, as currently the VPlan for VF = 1 is not 100% accurate representation of the original scalar loop (e.g. could have multiple replicate regions for multiple original instructions in the same predicated block).
The code should be gone after a rebase
https://github.com/llvm/llvm-project/pull/160449
More information about the llvm-commits
mailing list