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"
@@ -9557,13 +9556,8 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9557
9556
return !CM.requiresScalarEpilogue (VF.isVector ());
9558
9557
},
9559
9558
Range);
9560
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9561
- // Build hierarchical CFG.
9562
- // TODO: Convert to VPlan-transform and consolidate all transforms for VPlan
9563
- // creation.
9564
- VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
9565
- HCFGBuilder.buildPlainCFG();
9566
-
9559
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9560
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9567
9561
VPlanTransforms::createLoopRegions (*Plan, Legal->getWidestInductionType (),
9568
9562
PSE, RequiresScalarEpilogueCheck,
9569
9563
CM.foldTailByMasking (), OrigLoop);
@@ -9642,7 +9636,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9642
9636
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
9643
9637
// Handle VPBBs down to the latch.
9644
9638
if (VPBB == LoopRegion->getExiting ()) {
9645
- assert(!HCFGBuilder.getIRBBForVPB (VPBB) &&
9639
+ assert (!VPB2IRBB. contains (VPBB) &&
9646
9640
" the latch block shouldn't have a corresponding IRBB" );
9647
9641
VPBlockUtils::connectBlocks (PrevVPBB, VPBB);
9648
9642
break ;
@@ -9658,7 +9652,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9658
9652
// FIXME: At the moment, masks need to be placed at the beginning of the
9659
9653
// block, as blends introduced for phi nodes need to use it. The created
9660
9654
// blends should be sunk after the mask recipes.
9661
- RecipeBuilder.createBlockInMask(HCFGBuilder.getIRBBForVPB (VPBB));
9655
+ RecipeBuilder.createBlockInMask (VPB2IRBB. lookup (VPBB));
9662
9656
}
9663
9657
9664
9658
// Convert input VPInstructions to widened recipes.
@@ -9862,12 +9856,8 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
9862
9856
assert (!OrigLoop->isInnermost ());
9863
9857
assert (EnableVPlanNativePath && " VPlan-native path is not enabled." );
9864
9858
9865
- // Create new empty VPlan
9866
- auto Plan = std::make_unique<VPlan>(OrigLoop);
9867
- // Build hierarchical CFG
9868
- VPlanHCFGBuilder HCFGBuilder(OrigLoop, LI, *Plan);
9869
- HCFGBuilder.buildPlainCFG();
9870
-
9859
+ DenseMap<VPBlockBase *, BasicBlock *> VPB2IRBB;
9860
+ auto Plan = VPlanTransforms::buildPlainCFG (OrigLoop, *LI, VPB2IRBB);
9871
9861
VPlanTransforms::createLoopRegions (*Plan, Legal->getWidestInductionType (),
9872
9862
PSE, true , false , OrigLoop);
9873
9863
0 commit comments