@@ -2180,36 +2180,37 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
21802180 // / Descriptor for the reduction.
21812181 const RecurrenceDescriptor &RdxDesc;
21822182
2183- // / The phi is part of an in-loop reduction.
2184- bool IsInLoop;
2185-
21862183 // / The phi is part of an ordered reduction. Requires IsInLoop to be true.
21872184 bool IsOrdered;
21882185
2189- // / When expanding the reduction PHI, the plan's VF element count is divided
2190- // / by this factor to form the reduction phi's VF.
2186+ // / The scaling factor, relative to the VF, that this recipe's output is
2187+ // / divided by.
2188+ // / For outer-loop reductions this is equal to 1.
2189+ // / For in-loop reductions this is equal to 0, to specify that this is equal
2190+ // / to the VF (which may not be known yet). For partial-reductions this is
2191+ // / equal to another scalar value.
21912192 unsigned VFScaleFactor;
21922193
21932194public:
21942195 // / Create a new VPReductionPHIRecipe for the reduction \p Phi described by \p
21952196 // / RdxDesc.
21962197 VPReductionPHIRecipe (PHINode *Phi, const RecurrenceDescriptor &RdxDesc,
2197- VPValue &Start, bool IsInLoop = false ,
2198- bool IsOrdered = false , unsigned VFScaleFactor = 1 )
2198+ VPValue &Start, bool IsOrdered = false ,
2199+ unsigned VFScaleFactor = 1 )
21992200 : VPHeaderPHIRecipe(VPDef::VPReductionPHISC, Phi, &Start),
2200- RdxDesc (RdxDesc), IsInLoop(IsInLoop ), IsOrdered(IsOrdered),
2201- VFScaleFactor(VFScaleFactor) {
2202- assert ((!IsOrdered || IsInLoop) && " IsOrdered requires IsInLoop " );
2203- assert (((!IsInLoop && !IsOrdered) || VFScaleFactor == 0 ) &&
2201+ RdxDesc (RdxDesc), IsOrdered(IsOrdered ), VFScaleFactor(VFScaleFactor) {
2202+ assert ((!IsOrdered || isInLoop ()) &&
2203+ " IsOrdered requires the reduction to be in-loop " );
2204+ assert (((!isInLoop () && !IsOrdered) || isInLoop () ) &&
22042205 " Invalid VFScaleFactor" );
22052206 }
22062207
22072208 ~VPReductionPHIRecipe () override = default ;
22082209
22092210 VPReductionPHIRecipe *clone () override {
2210- auto *R = new VPReductionPHIRecipe (cast<PHINode>( getUnderlyingInstr ()),
2211- RdxDesc, * getOperand ( 0 ), IsInLoop ,
2212- IsOrdered, VFScaleFactor);
2211+ auto *R =
2212+ new VPReductionPHIRecipe (cast<PHINode>( getUnderlyingInstr ()), RdxDesc ,
2213+ * getOperand ( 0 ), IsOrdered, VFScaleFactor);
22132214 R->addOperand (getBackedgeValue ());
22142215 return R;
22152216 }
@@ -2235,8 +2236,8 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22352236 // / Returns true, if the phi is part of an ordered reduction.
22362237 bool isOrdered () const { return IsOrdered; }
22372238
2238- // / Returns true, if the phi is part of an in-loop reduction.
2239- bool isInLoop () const { return IsInLoop ; }
2239+ // / Returns true if the phi is part of an in-loop reduction.
2240+ bool isInLoop () const { return VFScaleFactor == 0 ; }
22402241
22412242 bool isPartialReduction () const { return VFScaleFactor > 1 ; }
22422243
0 commit comments