Skip to content

Commit b72bbfc

Browse files
committed
[VPlan] Remove fixHeaderPhis (NFC).
Removes unneeded code after #124432.
1 parent 8102fec commit b72bbfc

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
86888678
VPReplicateRecipe *
86898679
VPRecipeBuilder::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

llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,6 @@ class VPRecipeBuilder {
225225
ArrayRef<VPValue *> Operands,
226226
VFRange &Range);
227227

228-
/// Add the incoming values from the backedge to reduction & first-order
229-
/// recurrence cross-iteration phis.
230-
void fixHeaderPhis();
231-
232228
VPValue *getVPValueOrAddLiveIn(Value *V) {
233229
if (auto *I = dyn_cast<Instruction>(V)) {
234230
if (auto *R = Ingredient2Recipe.lookup(I))

0 commit comments

Comments
 (0)