Skip to content

Commit 9648271

Browse files
committed
[LV] Pass flag indicating epilogue is vectorized to executePlan (NFC)
This clarifies the flag, which is now only passed if the epilogue loop is being vectorized.
1 parent 6194668 commit 9648271

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ class LoopVectorizationPlanner {
435435
/// Generate the IR code for the vectorized loop captured in VPlan \p BestPlan
436436
/// according to the best selected \p VF and \p UF.
437437
///
438-
/// TODO: \p IsEpilogueVectorization is needed to avoid issues due to epilogue
439-
/// vectorization re-using plans for both the main and epilogue vector loops.
440-
/// It should be removed once the re-use issue has been fixed.
438+
/// TODO: \p VectorizingEpilogue indicates if the executed VPlan is for the
439+
/// epilogue vector loop. It should be removed once the re-use issue has been
440+
/// fixed.
441441
/// \p ExpandedSCEVs is passed during execution of the plan for epilogue loop
442442
/// to re-use expansion results generated during main plan execution.
443443
///
@@ -447,7 +447,7 @@ class LoopVectorizationPlanner {
447447
DenseMap<const SCEV *, Value *>
448448
executePlan(ElementCount VF, unsigned UF, VPlan &BestPlan,
449449
InnerLoopVectorizer &LB, DominatorTree *DT,
450-
bool IsEpilogueVectorization,
450+
bool VectorizingEpilogue,
451451
const DenseMap<const SCEV *, Value *> *ExpandedSCEVs = nullptr);
452452

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

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7626,16 +7626,16 @@ static void createAndCollectMergePhiForReduction(
76267626

76277627
DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
76287628
ElementCount BestVF, unsigned BestUF, VPlan &BestVPlan,
7629-
InnerLoopVectorizer &ILV, DominatorTree *DT, bool IsEpilogueVectorization,
7629+
InnerLoopVectorizer &ILV, DominatorTree *DT, bool VectorizingEpilogue,
76307630
const DenseMap<const SCEV *, Value *> *ExpandedSCEVs) {
76317631
assert(BestVPlan.hasVF(BestVF) &&
76327632
"Trying to execute plan with unsupported VF");
76337633
assert(BestVPlan.hasUF(BestUF) &&
76347634
"Trying to execute plan with unsupported UF");
76357635
assert(
7636-
(IsEpilogueVectorization || !ExpandedSCEVs) &&
7636+
((VectorizingEpilogue && ExpandedSCEVs) ||
7637+
(!VectorizingEpilogue && !ExpandedSCEVs)) &&
76377638
"expanded SCEVs to reuse can only be used during epilogue vectorization");
7638-
(void)IsEpilogueVectorization;
76397639

76407640
// TODO: Move to VPlan transform stage once the transition to the VPlan-based
76417641
// cost model is complete for better cost estimates.
@@ -7661,8 +7661,8 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
76617661
if (!ILV.getTripCount())
76627662
ILV.setTripCount(State.get(BestVPlan.getTripCount(), VPLane(0)));
76637663
else
7664-
assert(IsEpilogueVectorization && "should only re-use the existing trip "
7665-
"count during epilogue vectorization");
7664+
assert(VectorizingEpilogue && "should only re-use the existing trip "
7665+
"count during epilogue vectorization");
76667666

76677667
// 1. Set up the skeleton for vectorization, including vector pre-header and
76687668
// middle block. The vector loop is created during VPlan execution.
@@ -7715,7 +7715,7 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
77157715
for (VPRecipeBase &R : *ExitVPBB) {
77167716
createAndCollectMergePhiForReduction(
77177717
dyn_cast<VPInstruction>(&R), State, OrigLoop,
7718-
State.CFG.VPBB2IRBB[ExitVPBB], ExpandedSCEVs);
7718+
State.CFG.VPBB2IRBB[ExitVPBB], VectorizingEpilogue);
77197719
}
77207720

77217721
// 2.6. Maintain Loop Hints
@@ -10233,7 +10233,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1023310233

1023410234
std::unique_ptr<VPlan> BestMainPlan(BestPlan.duplicate());
1023510235
auto ExpandedSCEVs = LVP.executePlan(EPI.MainLoopVF, EPI.MainLoopUF,
10236-
*BestMainPlan, MainILV, DT, true);
10236+
*BestMainPlan, MainILV, DT, false);
1023710237
++LoopsVectorized;
1023810238

1023910239
// Second pass vectorizes the epilogue and adjusts the control flow

0 commit comments

Comments
 (0)