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"
@@ -9332,13 +9331,8 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9332
9331
return !CM.requiresScalarEpilogue (VF.isVector ());
9333
9332
},
9334
9333
Range);
9335
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9336
- // Build hierarchical CFG.
9337
- // TODO: Convert to VPlan-transform and consoliate all transforms for VPlan
9338
- // creation.
9339
- VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
9340
- HCFGBuilder.buildPlainCFG();
9341
-
9334
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9335
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9342
9336
VPlanTransforms::introduceRegions (*Plan, Legal->getWidestInductionType (), PSE,
9343
9337
RequiresScalarEpilogueCheck,
9344
9338
CM.foldTailByMasking (), OrigLoop);
@@ -9417,7 +9411,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9417
9411
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
9418
9412
// Handle VPBBs down to the latch.
9419
9413
if (VPBB == LoopRegion->getExiting ()) {
9420
- assert(!HCFGBuilder.getIRBBForVPB (VPBB) &&
9414
+ assert (!VPB2IRBB. contains (VPBB) &&
9421
9415
" the latch block shouldn't have a corresponding IRBB" );
9422
9416
VPBlockUtils::connectBlocks (PrevVPBB, VPBB);
9423
9417
break ;
@@ -9433,7 +9427,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9433
9427
// FIXME: At the moment, masks need to be placed at the beginning of the
9434
9428
// block, as blends introduced for phi nodes need to use it. The created
9435
9429
// blends should be sunk after the mask recipes.
9436
- RecipeBuilder.createBlockInMask(HCFGBuilder.getIRBBForVPB (VPBB));
9430
+ RecipeBuilder.createBlockInMask (VPB2IRBB. lookup (VPBB));
9437
9431
}
9438
9432
9439
9433
// Convert input VPInstructions to widened recipes.
@@ -9637,12 +9631,8 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
9637
9631
assert (!OrigLoop->isInnermost ());
9638
9632
assert (EnableVPlanNativePath && " VPlan-native path is not enabled." );
9639
9633
9640
- // Create new empty VPlan
9641
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9642
- // Build hierarchical CFG
9643
- VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
9644
- HCFGBuilder.buildPlainCFG();
9645
-
9634
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9635
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9646
9636
VPlanTransforms::introduceRegions (*Plan, Legal->getWidestInductionType (), PSE,
9647
9637
true , false , OrigLoop);
9648
9638
0 commit comments