@@ -466,28 +466,27 @@ void VPlanTransforms::prepareForVectorization(
466
466
VPDominatorTree VPDT;
467
467
VPDT.recalculate (Plan);
468
468
469
- VPBlockBase *HeaderVPB = Plan.getEntry ()->getSingleSuccessor ();
470
- canonicalHeaderAndLatch (HeaderVPB , VPDT);
471
- VPBlockBase *LatchVPB = HeaderVPB ->getPredecessors ()[1 ];
469
+ auto *HeaderVPBB = cast<VPBasicBlock>( Plan.getEntry ()->getSingleSuccessor () );
470
+ canonicalHeaderAndLatch (HeaderVPBB , VPDT);
471
+ auto *LatchVPBB = cast<VPBasicBlock>(HeaderVPBB ->getPredecessors ()[1 ]) ;
472
472
473
473
VPBasicBlock *VecPreheader = Plan.createVPBasicBlock (" vector.ph" );
474
474
VPBlockUtils::insertBlockAfter (VecPreheader, Plan.getEntry ());
475
475
476
476
VPBasicBlock *MiddleVPBB = Plan.createVPBasicBlock (" middle.block" );
477
- // The canonical LatchVPB has the header block as last successor. If it has
477
+ // The canonical LatchVPBB has the header block as last successor. If it has
478
478
// another successor, this successor is an exit block - insert middle block on
479
479
// its edge. Otherwise, add middle block as another successor retaining header
480
480
// as last.
481
- if (LatchVPB ->getNumSuccessors () == 2 ) {
482
- VPBlockBase *LatchExitVPB = LatchVPB ->getSuccessors ()[0 ];
483
- VPBlockUtils::insertOnEdge (LatchVPB , LatchExitVPB, MiddleVPBB);
481
+ if (LatchVPBB ->getNumSuccessors () == 2 ) {
482
+ VPBlockBase *LatchExitVPB = LatchVPBB ->getSuccessors ()[0 ];
483
+ VPBlockUtils::insertOnEdge (LatchVPBB , LatchExitVPB, MiddleVPBB);
484
484
} else {
485
- VPBlockUtils::connectBlocks (LatchVPB , MiddleVPBB);
486
- LatchVPB ->swapSuccessors ();
485
+ VPBlockUtils::connectBlocks (LatchVPBB , MiddleVPBB);
486
+ LatchVPBB ->swapSuccessors ();
487
487
}
488
488
489
- addCanonicalIVRecipes (Plan, cast<VPBasicBlock>(HeaderVPB),
490
- cast<VPBasicBlock>(LatchVPB), InductionTy, IVDL);
489
+ addCanonicalIVRecipes (Plan, HeaderVPBB, LatchVPBB, InductionTy, IVDL);
491
490
492
491
[[maybe_unused]] bool HandledUncountableEarlyExit = false ;
493
492
// Disconnect all early exits from the loop leaving it with a single exit from
@@ -503,8 +502,7 @@ void VPlanTransforms::prepareForVectorization(
503
502
assert (!HandledUncountableEarlyExit &&
504
503
" can handle exactly one uncountable early exit" );
505
504
handleUncountableEarlyExit (cast<VPBasicBlock>(Pred), EB, Plan,
506
- cast<VPBasicBlock>(HeaderVPB),
507
- cast<VPBasicBlock>(LatchVPB), Range);
505
+ HeaderVPBB, LatchVPBB, Range);
508
506
HandledUncountableEarlyExit = true ;
509
507
} else {
510
508
for (VPRecipeBase &R : EB->phis ())
0 commit comments