@@ -8510,21 +8510,16 @@ static void addCanonicalIVRecipes(VPlan &Plan, Type *IdxTy, bool HasNUW,
8510
8510
VPBasicBlock *Header = TopRegion->getEntryBasicBlock ();
8511
8511
Header->insert (CanonicalIVPHI, Header->begin ());
8512
8512
8513
- // Add a CanonicalIVIncrement{NUW} VPInstruction to increment the scalar
8514
- // IV by VF * UF.
8515
- auto *CanonicalIVIncrement =
8516
- new VPInstruction ( Instruction::Add, {CanonicalIVPHI, &Plan.getVFxUF ()},
8517
- {HasNUW, false }, DL, " index.next" );
8513
+ VPBuilder Builder (TopRegion-> getExitingBasicBlock ());
8514
+ // Add a VPInstruction to increment the scalar canonical IV by VF * UF.
8515
+ auto *CanonicalIVIncrement = Builder. createOverflowingOp (
8516
+ Instruction::Add, {CanonicalIVPHI, &Plan.getVFxUF ()}, {HasNUW, false }, DL ,
8517
+ " index.next" );
8518
8518
CanonicalIVPHI->addOperand (CanonicalIVIncrement);
8519
8519
8520
- VPBasicBlock *EB = TopRegion->getExitingBasicBlock ();
8521
- EB->appendRecipe (CanonicalIVIncrement);
8522
-
8523
8520
// Add the BranchOnCount VPInstruction to the latch.
8524
- VPInstruction *BranchBack =
8525
- new VPInstruction (VPInstruction::BranchOnCount,
8526
- {CanonicalIVIncrement, &Plan.getVectorTripCount ()}, DL);
8527
- EB->appendRecipe (BranchBack);
8521
+ Builder.createNaryOp (VPInstruction::BranchOnCount,
8522
+ {CanonicalIVIncrement, &Plan.getVectorTripCount ()}, DL);
8528
8523
}
8529
8524
8530
8525
// Add exit values to \p Plan. VPLiveOuts are added for each LCSSA phi in the
0 commit comments