@@ -2188,20 +2188,19 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
21882188
21892189 // / When expanding the reduction PHI, the plan's VF element count is divided
21902190 // / by this factor to form the reduction phi's VF.
2191- ElementCount VFScaleFactor;
2191+ unsigned VFScaleFactor;
21922192
21932193public:
21942194 // / Create a new VPReductionPHIRecipe for the reduction \p Phi described by \p
21952195 // / RdxDesc.
21962196 VPReductionPHIRecipe (PHINode *Phi, const RecurrenceDescriptor &RdxDesc,
21972197 VPValue &Start, bool IsInLoop = false ,
2198- bool IsOrdered = false ,
2199- ElementCount VFScaleFactor = ElementCount::getFixed(1 ))
2198+ bool IsOrdered = false , unsigned VFScaleFactor = 1 )
22002199 : VPHeaderPHIRecipe(VPDef::VPReductionPHISC, Phi, &Start),
22012200 RdxDesc (RdxDesc), IsInLoop(IsInLoop), IsOrdered(IsOrdered),
22022201 VFScaleFactor(VFScaleFactor) {
22032202 assert ((!IsOrdered || IsInLoop) && " IsOrdered requires IsInLoop" );
2204- assert (((!IsInLoop && !IsOrdered) || VFScaleFactor. isZero () ) &&
2203+ assert (((!IsInLoop && !IsOrdered) || VFScaleFactor == 0 ) &&
22052204 " Invalid VFScaleFactor" );
22062205 }
22072206
@@ -2221,7 +2220,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22212220 void execute(VPTransformState &State) override ;
22222221
22232222 // / Get the factor that the VF of this recipe's output should be scaled by.
2224- ElementCount getVFScaleFactor () const { return VFScaleFactor; }
2223+ unsigned getVFScaleFactor () const { return VFScaleFactor; }
22252224
22262225#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
22272226 // / Print the recipe.
@@ -2239,9 +2238,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
22392238 // / Returns true, if the phi is part of an in-loop reduction.
22402239 bool isInLoop () const { return IsInLoop; }
22412240
2242- bool isPartialReduction () const {
2243- return ElementCount::isKnownGT (VFScaleFactor, ElementCount::getFixed (1 ));
2244- }
2241+ bool isPartialReduction () const { return VFScaleFactor > 1 ; }
22452242
22462243 // / Returns true if the recipe only uses the first lane of operand \p Op.
22472244 bool onlyFirstLaneUsed (const VPValue *Op) const override {
@@ -2430,16 +2427,16 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
24302427 // / For in-loop reductions this is equal to 0, to specify that this is equal
24312428 // / to the VF (which may not be known yet). For partial-reductions this is
24322429 // / equal to another scalar value.
2433- ElementCount VFScaleFactor;
2430+ unsigned VFScaleFactor;
24342431
24352432protected:
24362433 VPReductionRecipe (const unsigned char SC, RecurKind RdxKind,
24372434 FastMathFlags FMFs, Instruction *I,
24382435 ArrayRef<VPValue *> Operands, VPValue *CondOp,
2439- bool IsOrdered, ElementCount VFScaleFactor, DebugLoc DL)
2436+ bool IsOrdered, unsigned VFScaleFactor, DebugLoc DL)
24402437 : VPRecipeWithIRFlags(SC, Operands, FMFs, DL), RdxKind(RdxKind),
24412438 IsOrdered (IsOrdered), VFScaleFactor(VFScaleFactor) {
2442- assert ((!IsOrdered || VFScaleFactor. isZero () ) && " Invalid scale factor" );
2439+ assert ((!IsOrdered || VFScaleFactor == 0 ) && " Invalid scale factor" );
24432440 if (CondOp) {
24442441 IsConditional = true ;
24452442 addOperand (CondOp);
@@ -2451,11 +2448,11 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
24512448 // / Note that the debug location is from the extend.
24522449 VPReductionRecipe (const unsigned char SC, const RecurKind RdxKind,
24532450 ArrayRef<VPValue *> Operands, VPValue *CondOp,
2454- bool IsOrdered, ElementCount VFScaleFactor, DebugLoc DL)
2451+ bool IsOrdered, unsigned VFScaleFactor, DebugLoc DL)
24552452 : VPRecipeWithIRFlags(SC, Operands, DL), RdxKind(RdxKind),
24562453 IsOrdered(IsOrdered), IsConditional(CondOp),
24572454 VFScaleFactor(VFScaleFactor) {
2458- assert ((!IsOrdered || VFScaleFactor. isZero () ) && " Invalid scale factor" );
2455+ assert ((!IsOrdered || VFScaleFactor == 0 ) && " Invalid scale factor" );
24592456 if (CondOp)
24602457 addOperand (CondOp);
24612458 }
@@ -2464,29 +2461,27 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
24642461 // / Note that the NUW/NSW flags and the debug location are from the Mul.
24652462 VPReductionRecipe (const unsigned char SC, const RecurKind RdxKind,
24662463 ArrayRef<VPValue *> Operands, VPValue *CondOp,
2467- bool IsOrdered, ElementCount VFScaleFactor,
2464+ bool IsOrdered, unsigned VFScaleFactor,
24682465 WrapFlagsTy WrapFlags, DebugLoc DL)
24692466 : VPRecipeWithIRFlags(SC, Operands, WrapFlags, DL), RdxKind(RdxKind),
24702467 IsOrdered(IsOrdered), IsConditional(CondOp),
24712468 VFScaleFactor(VFScaleFactor) {
2472- assert ((!IsOrdered || VFScaleFactor. isZero () ) && " Invalid scale factor" );
2469+ assert ((!IsOrdered || VFScaleFactor == 0 ) && " Invalid scale factor" );
24732470 if (CondOp)
24742471 addOperand (CondOp);
24752472 }
24762473
24772474public:
24782475 VPReductionRecipe (RecurKind RdxKind, FastMathFlags FMFs, Instruction *I,
24792476 VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
2480- bool IsOrdered, ElementCount VFScaleFactor,
2481- DebugLoc DL = {})
2477+ bool IsOrdered, unsigned VFScaleFactor, DebugLoc DL = {})
24822478 : VPReductionRecipe(VPDef::VPReductionSC, RdxKind, FMFs, I,
24832479 ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp,
24842480 IsOrdered, VFScaleFactor, DL) {}
24852481
24862482 VPReductionRecipe (const RecurKind RdxKind, FastMathFlags FMFs,
24872483 VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
2488- bool IsOrdered, ElementCount VFScaleFactor,
2489- DebugLoc DL = {})
2484+ bool IsOrdered, unsigned VFScaleFactor, DebugLoc DL = {})
24902485 : VPReductionRecipe(VPDef::VPReductionSC, RdxKind, FMFs, nullptr ,
24912486 ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp,
24922487 IsOrdered, VFScaleFactor, DL) {}
@@ -2531,9 +2526,7 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
25312526 // / Return true if the in-loop reduction is conditional.
25322527 bool isConditional () const { return IsConditional; };
25332528 // / Return true if the reduction is a partial reduction.
2534- bool isPartialReduction () const {
2535- return ElementCount::isKnownGT (VFScaleFactor, ElementCount::getFixed (1 ));
2536- }
2529+ bool isPartialReduction () const { return VFScaleFactor > 1 ; }
25372530 // / The VPValue of the scalar Chain being accumulated.
25382531 VPValue *getChainOp () const { return getOperand (0 ); }
25392532 // / The VPValue of the vector value to be reduced.
@@ -2543,7 +2536,7 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
25432536 return isConditional () ? getOperand (getNumOperands () - 1 ) : nullptr ;
25442537 }
25452538 // / Get the factor that the VF of this recipe's output should be scaled by.
2546- ElementCount getVFScaleFactor () const { return VFScaleFactor; }
2539+ unsigned getVFScaleFactor () const { return VFScaleFactor; }
25472540};
25482541
25492542// / A recipe to represent inloop reduction operations with vector-predication
@@ -2559,7 +2552,7 @@ class VPReductionEVLRecipe : public VPReductionRecipe {
25592552 R.getFastMathFlags(),
25602553 cast_or_null<Instruction>(R.getUnderlyingValue()),
25612554 ArrayRef<VPValue *>({R.getChainOp (), R.getVecOp (), &EVL}), CondOp,
2562- R.isOrdered(), ElementCount::getFixed( 0 ) , DL) {}
2555+ R.isOrdered(), 0 , DL) {}
25632556
25642557 ~VPReductionEVLRecipe () override = default ;
25652558
0 commit comments