Skip to content

Commit 9558817

Browse files
committed
!fixup address comments, thanks
1 parent f835229 commit 9558817

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8952,8 +8952,9 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
89528952
*Plan, Legal->getWidestInductionType(),
89538953
getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE,
89548954
OrigLoop);
8955-
VPlanTransforms::handleEarlyExitsAndAddMiddleCheck(*Plan, true, false, false,
8956-
Range);
8955+
VPlanTransforms::handleEarlyExitsAndAddMiddleCheck(
8956+
*Plan, /*RequiresScalarEpilogue*/ true, /*TailFolded*/ false,
8957+
/*HasUncountableExit*/ false, Range);
89578958
VPlanTransforms::createLoopRegions(*Plan);
89588959

89598960
for (ElementCount VF : Range)

llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ void VPlanTransforms::addInitialSkeleton(VPlan &Plan, Type *InductionTy,
493493
// vectorizing loops with uncountable early exits.
494494
const SCEV *BackedgeTakenCountSCEV = PSE.getSymbolicMaxBackedgeTakenCount();
495495
assert(!isa<SCEVCouldNotCompute>(BackedgeTakenCountSCEV) &&
496-
"Invalid loop count");
496+
"Invalid backedge-taken count");
497497
ScalarEvolution &SE = *PSE.getSE();
498498
const SCEV *TripCount = SE.getTripCountFromExitCount(BackedgeTakenCountSCEV,
499499
InductionTy, TheLoop);
@@ -554,8 +554,11 @@ void VPlanTransforms::handleEarlyExitsAndAddMiddleCheck(
554554
// If MiddleVPBB has a single successor then the original loop does not exit
555555
// via the latch and the single successor must be the scalar preheader.
556556
// There's no need to add a runtime check to MiddleVPBB.
557-
if (MiddleVPBB->getNumSuccessors() == 1)
557+
if (MiddleVPBB->getNumSuccessors() == 1) {
558+
assert(MiddleVPBB->getSingleSuccessor() == Plan.getScalarPreheader() &&
559+
"must have ScalarPH as single successor");
558560
return;
561+
}
559562

560563
assert(MiddleVPBB->getNumSuccessors() == 2 && "must have 2 successors");
561564

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct VPlanTransforms {
6969

7070
/// Update \p Plan to account for all early exits. If a check is needed to
7171
/// guard executing the scalar epilogue loop, it will be added to the middle
72-
/// block
72+
/// block.
7373
LLVM_ABI_FOR_TEST static void handleEarlyExitsAndAddMiddleCheck(
7474
VPlan &Plan, bool RequiresScalarEpilogueCheck, bool TailFolded,
7575
bool HasUncountableExit, VFRange &Range);

0 commit comments

Comments
 (0)