Skip to content

Commit 9f6c7c3

Browse files
fhahnmahesh-attarde
authored andcommitted
[VPlan] Remove dead code for scalar VFs in VPRegionBlock::cost (NFC).
The VPlan cost model is not used to compute costs of scalar VFs currently, as conversion to replicate regions makes accurately computing the original scalar cost difficult. Remove left over, dead code.
1 parent e65b56a commit 9f6c7c3

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -845,19 +845,10 @@ InstructionCost VPRegionBlock::cost(ElementCount VF, VPCostContext &Ctx) {
845845
if (VF.isScalable())
846846
return InstructionCost::getInvalid();
847847

848-
// First compute the cost of the conditionally executed recipes, followed by
849-
// account for the branching cost, except if the mask is a header mask or
850-
// uniform condition.
851-
using namespace llvm::VPlanPatternMatch;
848+
// Compute and return the cost of the conditionally executed recipes.
849+
assert(VF.isVector() && "Can only compute vector cost at the moment.");
852850
VPBasicBlock *Then = cast<VPBasicBlock>(getEntry()->getSuccessors()[0]);
853-
InstructionCost ThenCost = Then->cost(VF, Ctx);
854-
855-
// For the scalar case, we may not always execute the original predicated
856-
// block, Thus, scale the block's cost by the probability of executing it.
857-
if (VF.isScalar())
858-
return ThenCost / getPredBlockCostDivisor(Ctx.CostKind);
859-
860-
return ThenCost;
851+
return Then->cost(VF, Ctx);
861852
}
862853

863854
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

0 commit comments

Comments
 (0)