Skip to content

Commit 3c30bf1

Browse files
committed
Reduce cost only when not tail-folding
1 parent 0b23b3d commit 3c30bf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,7 +5616,7 @@ InstructionCost LoopVectorizationCostModel::expectedCost(ElementCount VF) {
56165616
// away.
56175617
SmallPtrSet<Instruction *, 2> ValuesToIgnoreForVF;
56185618
auto TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
5619-
if (VF.isFixed() && TC == VF.getFixedValue())
5619+
if (VF.isFixed() && TC == VF.getFixedValue() && !foldTailByMasking())
56205620
addFullyUnrolledInstructionsToIgnore(TheLoop, Legal->getInductionVars(),
56215621
ValuesToIgnoreForVF);
56225622

@@ -7316,7 +7316,7 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
73167316
// TODO: Remove this code after stepping away from the legacy cost model and
73177317
// adding code to simplify VPlans before calculating their costs.
73187318
auto TC = PSE.getSE()->getSmallConstantTripCount(OrigLoop);
7319-
if (VF.isFixed() && TC == VF.getFixedValue())
7319+
if (VF.isFixed() && TC == VF.getFixedValue() && !CM.foldTailByMasking())
73207320
addFullyUnrolledInstructionsToIgnore(OrigLoop, Legal->getInductionVars(),
73217321
CostCtx.SkipCostComputation);
73227322

0 commit comments

Comments
 (0)