Skip to content

Commit e5ef6d3

Browse files
committed
!fixup address latest comments, thanks
1 parent 170bc6c commit e5ef6d3

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9323,9 +9323,9 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
93239323
Range);
93249324
auto Plan = std::make_unique<VPlan>(OrigLoop);
93259325
// Build hierarchical CFG.
9326-
VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
9327-
// TODO: Convert to VPlan-transform and consoliate all transforms for VPlan
9326+
// Convert to VPlan-transform and consoliate all transforms for VPlan
93289327
// creation.
9328+
VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
93299329
HCFGBuilder.buildHierarchicalCFG();
93309330

93319331
VPlanTransforms::introduceTopLevelVectorLoopRegion(

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,6 +3570,13 @@ class VPlan {
35703570
return TripCount;
35713571
}
35723572

3573+
/// Set the trip count assuming it is currently null; if it is not - use
3574+
/// resetTripCount().
3575+
void setTripCount(VPValue *NewTripCount) {
3576+
assert(!TripCount && NewTripCount && "TripCount should not be set yet.");
3577+
TripCount = NewTripCount;
3578+
}
3579+
35733580
/// Resets the trip count for the VPlan. The caller must make sure all uses of
35743581
/// the original trip count have been replaced.
35753582
void resetTripCount(VPValue *NewTripCount) {
@@ -3578,14 +3585,6 @@ class VPlan {
35783585
TripCount = NewTripCount;
35793586
}
35803587

3581-
// Set the trip count assuming it is currently null; if it is not - use
3582-
// resetTripCount().
3583-
void setTripCount(VPValue *NewTripCount) {
3584-
assert(!TripCount && NewTripCount && "TripCount should not be set yet.");
3585-
3586-
TripCount = NewTripCount;
3587-
}
3588-
35893588
/// The backedge taken count of the original loop.
35903589
VPValue *getOrCreateBackedgeTakenCount() {
35913590
if (!BackedgeTakenCount)

llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ void VPlanTransforms::introduceTopLevelVectorLoopRegion(
3232
VPBlockUtils::disconnectBlocks(OriginalLatch, HeaderVPBB);
3333
VPBasicBlock *VecPreheader = Plan.createVPBasicBlock("vector.ph");
3434
VPBlockUtils::connectBlocks(Plan.getEntry(), VecPreheader);
35-
assert(OriginalLatch->getNumSuccessors() == 0 && "expected no predecessors");
35+
assert(OriginalLatch->getNumSuccessors() == 0 &&
36+
"Plan should end at top level latch");
3637

3738
// Create SCEV and VPValue for the trip count.
3839
// We use the symbolic max backedge-taken-count, which works also when
@@ -47,11 +48,13 @@ void VPlanTransforms::introduceTopLevelVectorLoopRegion(
4748
vputils::getOrCreateVPValueForSCEVExpr(Plan, TripCount, SE));
4849

4950
// Create VPRegionBlock, with existing header and new empty latch block, to be
50-
// filled
51+
// filled.
5152
VPBasicBlock *LatchVPBB = Plan.createVPBasicBlock("vector.latch");
5253
VPBlockUtils::insertBlockAfter(LatchVPBB, OriginalLatch);
5354
auto *TopRegion = Plan.createVPRegionBlock(
5455
HeaderVPBB, LatchVPBB, "vector loop", false /*isReplicator*/);
56+
// All VPBB's reachable shallowly from HeaderVPBB belong to top level loop,
57+
// because VPlan is expected to end at top level latch.
5558
for (VPBlockBase *VPBB : vp_depth_first_shallow(HeaderVPBB))
5659
VPBB->setParent(TopRegion);
5760

llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ void PlainCFGBuilder::buildPlainCFG(
382382
if (!isHeaderBB(BB, LoopForBB)) {
383383
setVPBBPredsFromBB(VPBB, BB);
384384
} else if (Region) {
385-
// BB is a loop header and there's a corresponding region , set the
385+
// BB is a loop header and there's a corresponding region, set the
386386
// predecessor for it.
387387
setRegionPredsFromBB(Region, BB);
388388
}

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct VPlanTransforms {
5555
/// Introduce the top-level VPRegionBlock for the main loop in \p Plan. Coming
5656
/// into this function, \p Plan's top-level loop is modeled using a plain CFG.
5757
/// This transform wraps the plain CFG of the top-level loop within a
58-
/// VPRegionBlock and creates a VPValue expressions for the original trip
58+
/// VPRegionBlock and creates a VPValue expression for the original trip
5959
/// count. It will also introduce a dedicated VPBasicBlock for the vector
6060
/// pre-header as well a VPBasicBlock as exit block of the region
6161
/// (middle.block). If a check is needed to guard executing the scalar

0 commit comments

Comments
 (0)