@@ -1073,9 +1073,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
1073
1073
1074
1074
// / Move loop-invariant recipes out of the vector loop region in \p Plan.
1075
1075
static void licm (VPlan &Plan) {
1076
- VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
1077
- VPBasicBlock *Preheader =
1078
- cast<VPBasicBlock>(LoopRegion->getSinglePredecessor ());
1076
+ VPBasicBlock *Preheader = Plan.getVectorPreheader ();
1079
1077
1080
1078
// Return true if we do not know how to (mechanically) hoist a given recipe
1081
1079
// out of a loop region. Does not address legality concerns such as aliasing
@@ -1089,6 +1087,7 @@ static void licm(VPlan &Plan) {
1089
1087
// Hoist any loop invariant recipes from the vector loop region to the
1090
1088
// preheader. Preform a shallow traversal of the vector loop region, to
1091
1089
// exclude recipes in replicate regions.
1090
+ VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
1092
1091
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
1093
1092
vp_depth_first_shallow (LoopRegion->getEntry ()))) {
1094
1093
for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
@@ -1133,7 +1132,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
1133
1132
DenseMap<VPValue *, VPWidenCastRecipe *> ProcessedTruncs;
1134
1133
Type *CanonicalIVType = Plan.getCanonicalIV ()->getScalarType ();
1135
1134
VPTypeAnalysis TypeInfo (CanonicalIVType);
1136
- VPBasicBlock *PH = Plan.getEntry ();
1135
+ VPBasicBlock *PH = Plan.getVectorPreheader ();
1137
1136
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
1138
1137
vp_depth_first_deep (Plan.getVectorLoopRegion ()))) {
1139
1138
for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
@@ -1317,7 +1316,7 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
1317
1316
// We can't use StartV directly in the ActiveLaneMask VPInstruction, since
1318
1317
// we have to take unrolling into account. Each part needs to start at
1319
1318
// Part * VF
1320
- auto *VecPreheader = cast<VPBasicBlock>(TopRegion-> getSinglePredecessor () );
1319
+ auto *VecPreheader = Plan. getVectorPreheader ( );
1321
1320
VPBuilder Builder (VecPreheader);
1322
1321
1323
1322
// Create the ActiveLaneMask instruction using the correct start values.
0 commit comments