[VPlan] Remove VPWidenPHIRecipe constructor without start value (NFC).

This was suggested as a separate cleanup in recent reviews.
This commit is contained in:
Florian Hahn 2021-12-28 18:31:41 +01:00
parent eb6b2efe4e
commit 7305798049
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
2 changed files with 11 additions and 10 deletions

View File

@ -4612,7 +4612,7 @@ void InnerLoopVectorizer::widenPHIInstruction(Instruction *PN,
Type *PhiType = II.getStep()->getType(); Type *PhiType = II.getStep()->getType();
// Build a pointer phi // Build a pointer phi
Value *ScalarStartValue = II.getStartValue(); Value *ScalarStartValue = PhiR->getStartValue()->getLiveInIRValue();
Type *ScStValueType = ScalarStartValue->getType(); Type *ScStValueType = ScalarStartValue->getType();
PHINode *NewPointerPhi = PHINode *NewPointerPhi =
PHINode::Create(ScStValueType, 2, "pointer.phi", Induction); PHINode::Create(ScStValueType, 2, "pointer.phi", Induction);
@ -8874,11 +8874,14 @@ VPRecipeBuilder::tryToCreateWidenRecipe(Instruction *Instr,
Phi->getIncomingValueForBlock(OrigLoop->getLoopLatch()))); Phi->getIncomingValueForBlock(OrigLoop->getLoopLatch())));
PhisToFix.push_back(PhiRecipe); PhisToFix.push_back(PhiRecipe);
} else { } else {
// TODO: record start and backedge value for remaining pointer induction // TODO: record backedge value for remaining pointer induction phis.
// phis.
assert(Phi->getType()->isPointerTy() && assert(Phi->getType()->isPointerTy() &&
"only pointer phis should be handled here"); "only pointer phis should be handled here");
PhiRecipe = new VPWidenPHIRecipe(Phi); assert(Legal->getInductionVars().count(Phi) &&
"Not an induction variable");
InductionDescriptor II = Legal->getInductionVars().lookup(Phi);
VPValue *Start = Plan->getOrAddVPValue(II.getStartValue());
PhiRecipe = new VPWidenPHIRecipe(Phi, Start);
} }
return toVPRecipeResult(PhiRecipe); return toVPRecipeResult(PhiRecipe);

View File

@ -1118,13 +1118,11 @@ class VPWidenPHIRecipe : public VPHeaderPHIRecipe {
SmallVector<VPBasicBlock *, 2> IncomingBlocks; SmallVector<VPBasicBlock *, 2> IncomingBlocks;
public: public:
/// Create a VPWidenPHIRecipe for \p Phi
VPWidenPHIRecipe(PHINode *Phi)
: VPHeaderPHIRecipe(VPVWidenPHISC, VPWidenPHISC, Phi) {}
/// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start. /// Create a new VPWidenPHIRecipe for \p Phi with start value \p Start.
VPWidenPHIRecipe(PHINode *Phi, VPValue &Start) : VPWidenPHIRecipe(Phi) { VPWidenPHIRecipe(PHINode *Phi, VPValue *Start = nullptr)
addOperand(&Start); : VPHeaderPHIRecipe(VPVWidenPHISC, VPWidenPHISC, Phi) {
if (Start)
addOperand(Start);
} }
~VPWidenPHIRecipe() override = default; ~VPWidenPHIRecipe() override = default;