Skip to content

Commit fdfa9b2

Browse files
committed
Update comment, use VPCostContext CostKind
1 parent e0b79bc commit fdfa9b2

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5108,8 +5108,8 @@ InstructionCost LoopVectorizationCostModel::expectedCost(ElementCount VF) {
51085108
// unconditionally executed. For the scalar case, we may not always execute
51095109
// the predicated block, if it is an if-else block. Thus, scale the block's
51105110
// cost by the probability of executing it.
5111-
// getPredBlockCostDivisor won't include blocks that are only predicated due
5112-
// to tail folded loops
5111+
// getPredBlockCostDivisor will return 1 for blocks that are only predicated
5112+
// by the header mask when folding the tail.
51135113
if (VF.isScalar())
51145114
BlockCost /= getPredBlockCostDivisor(CostKind, BB);
51155115

@@ -6758,8 +6758,7 @@ bool VPCostContext::skipCostComputation(Instruction *UI, bool IsVector) const {
67586758
SkipCostComputation.contains(UI);
67596759
}
67606760

6761-
unsigned VPCostContext::getPredBlockCostDivisor(
6762-
TargetTransformInfo::TargetCostKind CostKind, BasicBlock *BB) const {
6761+
unsigned VPCostContext::getPredBlockCostDivisor(BasicBlock *BB) const {
67636762
return CM.getPredBlockCostDivisor(CostKind, BB);
67646763
}
67656764

llvm/lib/Transforms/Vectorize/VPlanHelpers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ struct VPCostContext {
354354

355355
/// \returns how much the cost of a predicated block should be divided by.
356356
/// Forwards to LoopVectorizationCostModel::getPredBlockCostDivisor.
357-
unsigned getPredBlockCostDivisor(TargetTransformInfo::TargetCostKind CostKind,
358-
BasicBlock *BB) const;
357+
unsigned getPredBlockCostDivisor(BasicBlock *BB) const;
359358

360359
/// Returns the OperandInfo for \p V, if it is a live-in.
361360
TargetTransformInfo::OperandValueInfo getOperandInfo(VPValue *V) const;

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,7 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
33493349
// Scale the cost by the probability of executing the predicated blocks.
33503350
// This assumes the predicated block for each vector lane is equally
33513351
// likely.
3352-
ScalarCost /= Ctx.getPredBlockCostDivisor(Ctx.CostKind, UI->getParent());
3352+
ScalarCost /= Ctx.getPredBlockCostDivisor(UI->getParent());
33533353
return ScalarCost;
33543354
}
33553355
case Instruction::Load:

0 commit comments

Comments
 (0)