@@ -8854,7 +8854,7 @@ static void addCanonicalIVRecipes(VPlan &Plan, Type *IdxTy, bool HasNUW,
88548854 {CanonicalIVIncrement, &Plan.getVectorTripCount ()}, DL);
88558855}
88568856
8857- // / Create and return a ResumePhi for \p WideIF , unless it is truncated. If the
8857+ // / Create and return a ResumePhi for \p WideIV , unless it is truncated. If the
88588858// / induction recipe is not canonical, creates a VPDerivedIVRecipe to compute
88598859// / the end value of the induction.
88608860static VPValue *addResumePhiRecipeForInduction (VPWidenInductionRecipe *WideIV,
@@ -10064,20 +10064,20 @@ static void preparePlanForMainVectorLoop(VPlan &MainPlan, VPlan &EpiPlan) {
1006410064 EpiWidenedPhis.insert (
1006510065 cast<PHINode>(R.getVPSingleValue ()->getUnderlyingValue ()));
1006610066 }
10067- for (VPRecipeBase &R : *cast<VPIRBasicBlock>(MainPlan.getScalarHeader ())) {
10067+ for (VPRecipeBase &R : make_early_inc_range (
10068+ *cast<VPIRBasicBlock>(MainPlan.getScalarHeader ()))) {
1006810069 auto *VPIRInst = cast<VPIRInstruction>(&R);
1006910070 auto *IRI = dyn_cast<PHINode>(&VPIRInst->getInstruction ());
1007010071 if (!IRI)
1007110072 break ;
1007210073 if (EpiWidenedPhis.contains (IRI))
1007310074 continue ;
1007410075 // There is no corresponding wide induction in the epilogue plan that would
10075- // need a resume value. Set the operand in VPIRInst to zero, so ResumePhi
10076- // can be removed . The resume values for the scalar loop will be created
10077- // during execution of EpiPlan.
10076+ // need a resume value. Remove the VPIRInst wrapping the scalar header phi
10077+ // together with the corresponding ResumePhi . The resume values for the
10078+ // scalar loop will be created during execution of EpiPlan.
1007810079 VPRecipeBase *ResumePhi = VPIRInst->getOperand (0 )->getDefiningRecipe ();
10079- VPIRInst->setOperand (
10080- 0 , MainPlan.getOrAddLiveIn (Constant::getNullValue (IRI->getType ())));
10080+ VPIRInst->eraseFromParent ();
1008110081 ResumePhi->eraseFromParent ();
1008210082 }
1008310083 VPlanTransforms::removeDeadRecipes (MainPlan);
0 commit comments