@@ -490,7 +490,7 @@ class InnerLoopVectorizer {
490
490
MinProfitableTripCount(MinProfitableTripCount), UF(UnrollFactor),
491
491
Builder(PSE.getSE()->getContext()), Cost(CM), BFI(BFI), PSI(PSI),
492
492
RTChecks(RTChecks), Plan(Plan),
493
- VectorPHVPB(Plan.getEntry()->getSingleSuccessor() ) {}
493
+ VectorPHVPB(Plan.getEntry()->getSuccessors()[1] ) {}
494
494
495
495
virtual ~InnerLoopVectorizer() = default;
496
496
@@ -2365,14 +2365,11 @@ InnerLoopVectorizer::getOrCreateVectorTripCount(BasicBlock *InsertBlock) {
2365
2365
void InnerLoopVectorizer::introduceCheckBlockInVPlan(BasicBlock *CheckIRBB) {
2366
2366
VPBlockBase *ScalarPH = Plan.getScalarPreheader();
2367
2367
VPBlockBase *PreVectorPH = VectorPHVPB->getSinglePredecessor();
2368
- if (PreVectorPH->getNumSuccessors() != 1) {
2369
- assert(PreVectorPH->getNumSuccessors() == 2 && "Expected 2 successors");
2370
- assert(PreVectorPH->getSuccessors()[0] == ScalarPH &&
2371
- "Unexpected successor");
2372
- VPIRBasicBlock *CheckVPIRBB = Plan.createVPIRBasicBlock(CheckIRBB);
2373
- VPBlockUtils::insertOnEdge(PreVectorPH, VectorPHVPB, CheckVPIRBB);
2374
- PreVectorPH = CheckVPIRBB;
2375
- }
2368
+ assert(PreVectorPH->getNumSuccessors() == 2 && "Expected 2 successors");
2369
+ assert(PreVectorPH->getSuccessors()[0] == ScalarPH && "Unexpected successor");
2370
+ VPIRBasicBlock *CheckVPIRBB = Plan.createVPIRBasicBlock(CheckIRBB);
2371
+ VPBlockUtils::insertOnEdge(PreVectorPH, VectorPHVPB, CheckVPIRBB);
2372
+ PreVectorPH = CheckVPIRBB;
2376
2373
VPBlockUtils::connectBlocks(PreVectorPH, ScalarPH);
2377
2374
PreVectorPH->swapSuccessors();
2378
2375
@@ -2463,9 +2460,6 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
2463
2460
setBranchWeights(BI, MinItersBypassWeights, /*IsExpected=*/false);
2464
2461
ReplaceInstWithInst(TCCheckBlock->getTerminator(), &BI);
2465
2462
LoopBypassBlocks.push_back(TCCheckBlock);
2466
-
2467
- // TODO: Wrap LoopVectorPreHeader in VPIRBasicBlock here.
2468
- introduceCheckBlockInVPlan(TCCheckBlock);
2469
2463
}
2470
2464
2471
2465
BasicBlock *InnerLoopVectorizer::emitSCEVChecks(BasicBlock *Bypass) {
@@ -7837,7 +7831,7 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
7837
7831
7838
7832
// 1. Set up the skeleton for vectorization, including vector pre-header and
7839
7833
// middle block. The vector loop is created during VPlan execution.
7840
- VPBasicBlock *VectorPH = cast<VPBasicBlock>(Entry->getSingleSuccessor() );
7834
+ VPBasicBlock *VectorPH = cast<VPBasicBlock>(Entry->getSuccessors()[1] );
7841
7835
State.CFG.PrevBB = ILV.createVectorizedLoopSkeleton();
7842
7836
if (VectorizingEpilogue)
7843
7837
VPlanTransforms::removeDeadRecipes(BestVPlan);
@@ -8070,7 +8064,8 @@ EpilogueVectorizerMainLoop::emitIterationCountCheck(BasicBlock *Bypass,
8070
8064
setBranchWeights(BI, MinItersBypassWeights, /*IsExpected=*/false);
8071
8065
ReplaceInstWithInst(TCCheckBlock->getTerminator(), &BI);
8072
8066
8073
- introduceCheckBlockInVPlan(TCCheckBlock);
8067
+ if (!ForEpilogue)
8068
+ introduceCheckBlockInVPlan(TCCheckBlock);
8074
8069
return TCCheckBlock;
8075
8070
}
8076
8071
@@ -8200,7 +8195,6 @@ EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(
8200
8195
Plan.setEntry(NewEntry);
8201
8196
// OldEntry is now dead and will be cleaned up when the plan gets destroyed.
8202
8197
8203
- introduceCheckBlockInVPlan(Insert);
8204
8198
return Insert;
8205
8199
}
8206
8200
@@ -9160,7 +9154,7 @@ static void addScalarResumePhis(VPRecipeBuilder &Builder, VPlan &Plan,
9160
9154
DenseMap<VPValue *, VPValue *> &IVEndValues) {
9161
9155
VPTypeAnalysis TypeInfo(Plan.getCanonicalIV()->getScalarType());
9162
9156
auto *ScalarPH = Plan.getScalarPreheader();
9163
- auto *MiddleVPBB = cast<VPBasicBlock>(ScalarPH->getSinglePredecessor() );
9157
+ auto *MiddleVPBB = cast<VPBasicBlock>(ScalarPH->getPredecessors()[0] );
9164
9158
VPRegionBlock *VectorRegion = Plan.getVectorLoopRegion();
9165
9159
VPBuilder VectorPHBuilder(
9166
9160
cast<VPBasicBlock>(VectorRegion->getSinglePredecessor()));
0 commit comments