59
59
#include " VPlan.h"
60
60
#include " VPlanAnalysis.h"
61
61
#include " VPlanCFG.h"
62
- #include " VPlanHCFGBuilder.h"
63
62
#include " VPlanHelpers.h"
64
63
#include " VPlanPatternMatch.h"
65
64
#include " VPlanTransforms.h"
@@ -9306,13 +9305,8 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9306
9305
return !CM.requiresScalarEpilogue (VF.isVector ());
9307
9306
},
9308
9307
Range);
9309
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9310
- // Build hierarchical CFG.
9311
- // TODO: Convert to VPlan-transform and consoliate all transforms for VPlan
9312
- // creation.
9313
- VPlanHCFGBuilder HCFGBuilder (OrigLoop, LI, *Plan);
9314
- HCFGBuilder.buildPlainCFG ();
9315
-
9308
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9309
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9316
9310
VPlanTransforms::introduceTopLevelVectorLoopRegion (
9317
9311
*Plan, Legal->getWidestInductionType (), PSE, RequiresScalarEpilogueCheck,
9318
9312
CM.foldTailByMasking (), OrigLoop);
@@ -9391,7 +9385,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9391
9385
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
9392
9386
// Handle VPBBs down to the latch.
9393
9387
if (VPBB == LoopRegion->getExiting ()) {
9394
- assert (!HCFGBuilder. getIRBBForVPB (VPBB) &&
9388
+ assert (!VPB2IRBB. contains (VPBB) &&
9395
9389
" the latch block shouldn't have a corresponding IRBB" );
9396
9390
VPBlockUtils::connectBlocks (PrevVPBB, VPBB);
9397
9391
break ;
@@ -9407,7 +9401,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9407
9401
// FIXME: At the moment, masks need to be placed at the beginning of the
9408
9402
// block, as blends introduced for phi nodes need to use it. The created
9409
9403
// blends should be sunk after the mask recipes.
9410
- RecipeBuilder.createBlockInMask (HCFGBuilder. getIRBBForVPB (VPBB));
9404
+ RecipeBuilder.createBlockInMask (VPB2IRBB. lookup (VPBB));
9411
9405
}
9412
9406
9413
9407
// Convert input VPInstructions to widened recipes.
@@ -9610,13 +9604,8 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
9610
9604
// the vectorization pipeline.
9611
9605
assert (!OrigLoop->isInnermost ());
9612
9606
assert (EnableVPlanNativePath && " VPlan-native path is not enabled." );
9613
-
9614
- // Create new empty VPlan
9615
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9616
- // Build hierarchical CFG
9617
- VPlanHCFGBuilder HCFGBuilder (OrigLoop, LI, *Plan);
9618
- HCFGBuilder.buildPlainCFG ();
9619
-
9607
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9608
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9620
9609
VPlanTransforms::introduceTopLevelVectorLoopRegion (
9621
9610
*Plan, Legal->getWidestInductionType (), PSE, true , false , OrigLoop);
9622
9611
0 commit comments