forked from OSchip/llvm-project
[VPlan] Separate ctors for VPWidenIntOrFpInduction. (NFC)
VPWidenIntOrFpInductionRecipes can either be constructed with a PHI and an optional cast or a PHI and a trunc instruction. Reflect this in 2 separate constructors. This also simplifies a follow-up change.
This commit is contained in:
parent
75b622a795
commit
7c3c352d82
|
@ -8628,7 +8628,7 @@ VPWidenIntOrFpInductionRecipe *VPRecipeBuilder::tryToOptimizeInductionTruncate(
|
|||
Legal->getInductionVars().lookup(cast<PHINode>(I->getOperand(0)));
|
||||
VPValue *Start = Plan.getOrAddVPValue(II.getStartValue());
|
||||
return new VPWidenIntOrFpInductionRecipe(cast<PHINode>(I->getOperand(0)),
|
||||
Start, nullptr, I);
|
||||
Start, I);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1007,17 +1007,20 @@ class VPWidenIntOrFpInductionRecipe : public VPRecipeBase {
|
|||
PHINode *IV;
|
||||
|
||||
public:
|
||||
VPWidenIntOrFpInductionRecipe(PHINode *IV, VPValue *Start, Instruction *Cast,
|
||||
TruncInst *Trunc = nullptr)
|
||||
VPWidenIntOrFpInductionRecipe(PHINode *IV, VPValue *Start,
|
||||
Instruction *Cast = nullptr)
|
||||
: VPRecipeBase(VPWidenIntOrFpInductionSC, {Start}), IV(IV) {
|
||||
if (Trunc)
|
||||
new VPValue(Trunc, this);
|
||||
else
|
||||
new VPValue(IV, this);
|
||||
new VPValue(IV, this);
|
||||
|
||||
if (Cast)
|
||||
new VPValue(Cast, this);
|
||||
}
|
||||
|
||||
VPWidenIntOrFpInductionRecipe(PHINode *IV, VPValue *Start, TruncInst *Trunc)
|
||||
: VPRecipeBase(VPWidenIntOrFpInductionSC, {Start}), IV(IV) {
|
||||
new VPValue(Trunc, this);
|
||||
}
|
||||
|
||||
~VPWidenIntOrFpInductionRecipe() override = default;
|
||||
|
||||
/// Method to support type inquiry through isa, cast, and dyn_cast.
|
||||
|
|
|
@ -48,7 +48,7 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
|
|||
if (II.getKind() == InductionDescriptor::IK_IntInduction ||
|
||||
II.getKind() == InductionDescriptor::IK_FpInduction) {
|
||||
VPValue *Start = Plan->getOrAddVPValue(II.getStartValue());
|
||||
NewRecipe = new VPWidenIntOrFpInductionRecipe(Phi, Start, nullptr);
|
||||
NewRecipe = new VPWidenIntOrFpInductionRecipe(Phi, Start);
|
||||
} else {
|
||||
Plan->addVPValue(Phi, VPPhi);
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue