Skip to content

Commit 4944d54

Browse files
committed
Address review comment
1 parent 686adb2 commit 4944d54

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7552,10 +7552,14 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
75527552
VPCostContext CostCtx(CM.TTI, *CM.TLI, Legal->getWidestInductionType(), CM,
75537553
CM.CostKind);
75547554
precomputeCosts(BestPlan, BestFactor.Width, CostCtx);
7555-
assert((BestFactor.Width == LegacyVF.Width ||
7556-
(BestPlan.getVectorLoopRegion() &&
7557-
BestPlan.getVectorLoopRegion()->getSingleSuccessor() !=
7558-
BestPlan.getMiddleBlock()) ||
7555+
// Set PlanForEarlyExitLoop to true if the BestPlan has been built from a
7556+
// loop with an uncountable early exit. The legacy cost model doesn't
7557+
// properly model costs for such loops.
7558+
bool PlanForEarlyExitLoop =
7559+
BestPlan.getVectorLoopRegion() &&
7560+
BestPlan.getVectorLoopRegion()->getSingleSuccessor() !=
7561+
BestPlan.getMiddleBlock();
7562+
assert((BestFactor.Width == LegacyVF.Width || PlanForEarlyExitLoop ||
75597563
planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width),
75607564
CostCtx, OrigLoop) ||
75617565
planContainsAdditionalSimplifications(getPlanFor(LegacyVF.Width),

0 commit comments

Comments
 (0)