@@ -2366,14 +2366,17 @@ class LLVM_ABI_FOR_TEST VPWidenPHIRecipe : public VPSingleDefRecipe,
23662366// / first operand of the recipe and the incoming value from the backedge is the
23672367// / second operand.
23682368struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
2369- VPFirstOrderRecurrencePHIRecipe (PHINode *Phi, VPValue &Start)
2370- : VPHeaderPHIRecipe(VPDef::VPFirstOrderRecurrencePHISC, Phi, &Start) {}
2369+ VPFirstOrderRecurrencePHIRecipe (PHINode *Phi, VPValue &Start,
2370+ VPValue &BackedgeValue)
2371+ : VPHeaderPHIRecipe(VPDef::VPFirstOrderRecurrencePHISC, Phi, &Start) {
2372+ addOperand (&BackedgeValue);
2373+ }
23712374
23722375 VP_CLASSOF_IMPL (VPDef::VPFirstOrderRecurrencePHISC)
23732376
23742377 VPFirstOrderRecurrencePHIRecipe *clone () override {
23752378 return new VPFirstOrderRecurrencePHIRecipe (
2376- cast<PHINode>(getUnderlyingInstr ()), *getOperand (0 ));
2379+ cast<PHINode>(getUnderlyingInstr ()), *getOperand (0 ), * getOperand ( 1 ) );
23772380 }
23782381
23792382 void execute (VPTransformState &State) override ;
@@ -2439,20 +2442,21 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
24392442public:
24402443 // / Create a new VPReductionPHIRecipe for the reduction \p Phi.
24412444 VPReductionPHIRecipe (PHINode *Phi, RecurKind Kind, VPValue &Start,
2442- ReductionStyle Style,
2445+ VPValue &BackedgeValue, ReductionStyle Style,
24432446 bool HasUsesOutsideReductionChain = false )
24442447 : VPHeaderPHIRecipe(VPDef::VPReductionPHISC, Phi, &Start), Kind(Kind),
24452448 Style (Style),
2446- HasUsesOutsideReductionChain(HasUsesOutsideReductionChain) {}
2449+ HasUsesOutsideReductionChain(HasUsesOutsideReductionChain) {
2450+ addOperand (&BackedgeValue);
2451+ }
24472452
24482453 ~VPReductionPHIRecipe () override = default ;
24492454
24502455 VPReductionPHIRecipe *clone () override {
2451- auto *R = new VPReductionPHIRecipe (
2456+ return new VPReductionPHIRecipe (
24522457 dyn_cast_or_null<PHINode>(getUnderlyingValue ()), getRecurrenceKind (),
2453- *getOperand (0 ), Style, HasUsesOutsideReductionChain);
2454- R->addOperand (getBackedgeValue ());
2455- return R;
2458+ *getOperand (0 ), *getBackedgeValue (), Style,
2459+ HasUsesOutsideReductionChain);
24562460 }
24572461
24582462 VP_CLASSOF_IMPL (VPDef::VPReductionPHISC)
0 commit comments