@@ -8675,16 +8675,6 @@ VPRecipeBuilder::tryToWidenHistogram(const HistogramInfo *HI,
86758675 HI->Store ->getDebugLoc ());
86768676}
86778677
8678- void VPRecipeBuilder::fixHeaderPhis () {
8679- BasicBlock *OrigLatch = OrigLoop->getLoopLatch ();
8680- for (VPHeaderPHIRecipe *R : PhisToFix) {
8681- auto *PN = cast<PHINode>(R->getUnderlyingValue ());
8682- VPRecipeBase *IncR =
8683- getRecipe (cast<Instruction>(PN->getIncomingValueForBlock (OrigLatch)));
8684- R->addOperand (IncR->getVPSingleValue ());
8685- }
8686- }
8687-
86888678VPReplicateRecipe *
86898679VPRecipeBuilder::handleReplication (Instruction *I, ArrayRef<VPValue *> Operands,
86908680 VFRange &Range) {
@@ -8870,6 +8860,7 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
88708860 if (Phi->getParent () != OrigLoop->getHeader ())
88718861 return tryToBlend (Phi, Operands);
88728862
8863+ assert (Operands.size () == 2 && " Must have 2 operands for header phis" );
88738864 if ((Recipe = tryToOptimizeInductionPHI (Phi, Operands, Range)))
88748865 return Recipe;
88758866
@@ -8897,8 +8888,8 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
88978888 // directly, enabling more efficient codegen.
88988889 PhiRecipe = new VPFirstOrderRecurrencePHIRecipe (Phi, *StartV);
88998890 }
8900-
8901- PhisToFix. push_back ( PhiRecipe);
8891+ // Add backedge value.
8892+ PhiRecipe-> addOperand (Operands[ 1 ] );
89028893 return PhiRecipe;
89038894 }
89048895
@@ -9500,7 +9491,6 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
95009491 !Plan->getVectorLoopRegion ()->getEntryBasicBlock ()->empty () &&
95019492 " entry block must be set to a VPRegionBlock having a non-empty entry "
95029493 " VPBasicBlock" );
9503- RecipeBuilder.fixHeaderPhis ();
95049494
95059495 // Update wide induction increments to use the same step as the corresponding
95069496 // wide induction. This enables detecting induction increments directly in
0 commit comments