@@ -1073,9 +1073,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
10731073
10741074// / Move loop-invariant recipes out of the vector loop region in \p Plan.
10751075static void licm (VPlan &Plan) {
1076- VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
1077- VPBasicBlock *Preheader =
1078- cast<VPBasicBlock>(LoopRegion->getSinglePredecessor ());
1076+ VPBasicBlock *Preheader = Plan.getVectorPreheader ();
10791077
10801078 // Return true if we do not know how to (mechanically) hoist a given recipe
10811079 // out of a loop region. Does not address legality concerns such as aliasing
@@ -1089,6 +1087,7 @@ static void licm(VPlan &Plan) {
10891087 // Hoist any loop invariant recipes from the vector loop region to the
10901088 // preheader. Preform a shallow traversal of the vector loop region, to
10911089 // exclude recipes in replicate regions.
1090+ VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
10921091 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
10931092 vp_depth_first_shallow (LoopRegion->getEntry ()))) {
10941093 for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
@@ -1133,7 +1132,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
11331132 DenseMap<VPValue *, VPWidenCastRecipe *> ProcessedTruncs;
11341133 Type *CanonicalIVType = Plan.getCanonicalIV ()->getScalarType ();
11351134 VPTypeAnalysis TypeInfo (CanonicalIVType);
1136- VPBasicBlock *PH = Plan.getEntry ();
1135+ VPBasicBlock *PH = Plan.getVectorPreheader ();
11371136 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
11381137 vp_depth_first_deep (Plan.getVectorLoopRegion ()))) {
11391138 for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
@@ -1317,7 +1316,7 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
13171316 // We can't use StartV directly in the ActiveLaneMask VPInstruction, since
13181317 // we have to take unrolling into account. Each part needs to start at
13191318 // Part * VF
1320- auto *VecPreheader = cast<VPBasicBlock>(TopRegion-> getSinglePredecessor () );
1319+ auto *VecPreheader = Plan. getVectorPreheader ( );
13211320 VPBuilder Builder (VecPreheader);
13221321
13231322 // Create the ActiveLaneMask instruction using the correct start values.
0 commit comments