Skip to content

Commit f3d93f5

Browse files
authored
[LV] Don't access loop after executePlan in native path (NFC). (llvm#191277)
Bring native path in line with inner loop path: the loop may become invalid once we are able to remove the scalar loop in the native path as well. Match inner loop behavior by reporting vectorization before executePlan, and using F instead of L->getHeader()->getParent().
1 parent a0f0d63 commit f3d93f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8661,20 +8661,20 @@ static bool processLoopInVPlanNativePath(
86618661
GeneratedRTChecks Checks(PSE, DT, LI, TTI, CM.CostKind);
86628662
InnerLoopVectorizer LB(L, PSE, LI, DT, TTI, AC, VF.Width, /*UF=*/1, &CM,
86638663
Checks, BestPlan);
8664-
LLVM_DEBUG(dbgs() << "Vectorizing outer loop in \""
8665-
<< L->getHeader()->getParent()->getName() << "\"\n");
8664+
LLVM_DEBUG(dbgs() << "Vectorizing outer loop in \"" << F->getName()
8665+
<< "\"\n");
86668666
LVP.addMinimumIterationCheck(BestPlan, VF.Width, /*UF=*/1,
86678667
VF.MinProfitableTripCount);
86688668
bool HasBranchWeights =
86698669
hasBranchWeightMD(*L->getLoopLatch()->getTerminator());
86708670
LVP.attachRuntimeChecks(BestPlan, Checks, HasBranchWeights);
86718671

8672+
reportVectorization(ORE, L, VF, 1);
8673+
86728674
LVP.executePlan(VF.Width, /*UF=*/1, BestPlan, LB, DT);
86738675
}
86748676

8675-
reportVectorization(ORE, L, VF, 1);
8676-
8677-
assert(!verifyFunction(*L->getHeader()->getParent(), &dbgs()));
8677+
assert(!verifyFunction(*F, &dbgs()));
86788678
return true;
86798679
}
86808680

0 commit comments

Comments
 (0)