Skip to content

Commit 886bcc2

Browse files
committed
!fixup restore part of assert and fix formatting
1 parent 22eeebe commit 886bcc2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,12 @@ VPlanPtr VPlan::createInitialVPlan(Type *InductionTy,
862862
VPIRBasicBlock *Entry =
863863
VPIRBasicBlock::fromBasicBlock(TheLoop->getLoopPreheader());
864864
VPBasicBlock *VecPreheader = new VPBasicBlock("vector.ph");
865-
// Connect entry only to vector preheader initially. Entry will also be connected to the scalar preheader later, during skeleton creation when runtime guards are added as needed.
866-
// Note that when executing the VPlan for an epilogue vector loop, the original entry block here will be replaced by a new VPIRBasicBlock wrapping the entry to the epilogue vector loop after generating code for the main vector loop.
865+
// Connect entry only to vector preheader initially. Entry will also be
866+
// connected to the scalar preheader later, during skeleton creation when
867+
// runtime guards are added as needed. Note that when executing the VPlan for
868+
// an epilogue vector loop, the original entry block here will be replaced by
869+
// a new VPIRBasicBlock wrapping the entry to the epilogue vector loop after
870+
// generating code for the main vector loop.
867871
VPBlockUtils::connectBlocks(Entry, VecPreheader);
868872
VPIRBasicBlock *ScalarHeader =
869873
VPIRBasicBlock::fromBasicBlock(TheLoop->getHeader());

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3845,7 +3845,9 @@ class VPlan {
38453845

38463846
/// Create initial VPlan, having an "entry" VPBasicBlock (wrapping
38473847
/// original scalar pre-header) which contains SCEV expansions that need
3848-
/// to happen before the CFG is modified (when executing a VPlan for the epilogue vector loop, the original entry needs to be replaced by the new entry for the epilogue vector loop); a VPBasicBlock for the vector
3848+
/// to happen before the CFG is modified (when executing a VPlan for the
3849+
/// epilogue vector loop, the original entry needs to be replaced by the new
3850+
/// entry for the epilogue vector loop); a VPBasicBlock for the vector
38493851
/// pre-header, followed by a region for the vector loop, followed by the
38503852
/// middle VPBasicBlock. If a check is needed to guard executing the scalar
38513853
/// epilogue loop, it will be added to the middle block, together with
@@ -4176,6 +4178,8 @@ class VPBlockUtils {
41764178
unsigned PredIdx = -1u, unsigned SuccIdx = -1u) {
41774179
assert((From->getParent() == To->getParent()) &&
41784180
"Can't connect two block with different parents");
4181+
assert((SuccIdx != -1u || From->getNumSuccessors() < 2) &&
4182+
"Blocks can't have more than two successors.");
41794183
if (SuccIdx == -1u)
41804184
From->appendSuccessor(To);
41814185
else

0 commit comments

Comments
 (0)