Skip to content

Commit f9f7aa3

Browse files
committed
[VPlan] Remove dead code to create VPWidenPHIRecipes (NFCI).
After introducing VPWidenPointerInductionRecipe, VPWidenPHIRecipes should not be created at this point. Turn check into an assert.
1 parent 0d8cb8b commit f9f7aa3

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8580,37 +8580,28 @@ VPRecipeBuilder::tryToCreateWidenRecipe(Instruction *Instr,
85808580
return toVPRecipeResult(Recipe);
85818581

85828582
VPHeaderPHIRecipe *PhiRecipe = nullptr;
8583-
if (Legal->isReductionVariable(Phi) || Legal->isFirstOrderRecurrence(Phi)) {
8584-
VPValue *StartV = Operands[0];
8585-
if (Legal->isReductionVariable(Phi)) {
8586-
const RecurrenceDescriptor &RdxDesc =
8587-
Legal->getReductionVars().find(Phi)->second;
8588-
assert(RdxDesc.getRecurrenceStartValue() ==
8589-
Phi->getIncomingValueForBlock(OrigLoop->getLoopPreheader()));
8590-
PhiRecipe = new VPReductionPHIRecipe(Phi, RdxDesc, *StartV,
8591-
CM.isInLoopReduction(Phi),
8592-
CM.useOrderedReductions(RdxDesc));
8593-
} else {
8594-
PhiRecipe = new VPFirstOrderRecurrencePHIRecipe(Phi, *StartV);
8595-
}
8583+
assert((Legal->isReductionVariable(Phi) ||
8584+
Legal->isFirstOrderRecurrence(Phi)) &&
8585+
"can only widen reductions and first-order recurrences here");
8586+
VPValue *StartV = Operands[0];
8587+
if (Legal->isReductionVariable(Phi)) {
8588+
const RecurrenceDescriptor &RdxDesc =
8589+
Legal->getReductionVars().find(Phi)->second;
8590+
assert(RdxDesc.getRecurrenceStartValue() ==
8591+
Phi->getIncomingValueForBlock(OrigLoop->getLoopPreheader()));
8592+
PhiRecipe = new VPReductionPHIRecipe(Phi, RdxDesc, *StartV,
8593+
CM.isInLoopReduction(Phi),
8594+
CM.useOrderedReductions(RdxDesc));
8595+
} else {
8596+
PhiRecipe = new VPFirstOrderRecurrencePHIRecipe(Phi, *StartV);
8597+
}
85968598

85978599
// Record the incoming value from the backedge, so we can add the incoming
85988600
// value from the backedge after all recipes have been created.
85998601
recordRecipeOf(cast<Instruction>(
86008602
Phi->getIncomingValueForBlock(OrigLoop->getLoopLatch())));
86018603
PhisToFix.push_back(PhiRecipe);
8602-
} else {
8603-
// TODO: record backedge value for remaining pointer induction phis.
8604-
assert(Phi->getType()->isPointerTy() &&
8605-
"only pointer phis should be handled here");
8606-
assert(Legal->getInductionVars().count(Phi) &&
8607-
"Not an induction variable");
8608-
InductionDescriptor II = Legal->getInductionVars().lookup(Phi);
8609-
VPValue *Start = Plan->getOrAddVPValue(II.getStartValue());
8610-
PhiRecipe = new VPWidenPHIRecipe(Phi, Start);
8611-
}
8612-
8613-
return toVPRecipeResult(PhiRecipe);
8604+
return toVPRecipeResult(PhiRecipe);
86148605
}
86158606

86168607
if (isa<TruncInst>(Instr) &&

0 commit comments

Comments
 (0)