================
@@ -2333,32 +2332,35 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
/// The recurrence kind of the reduction.
const RecurKind Kind;
- /// The phi is part of an in-loop reduction.
- bool IsInLoop;
-
/// The phi is part of an ordered reduction. Requires IsInLoop to be true.
bool IsOrdered;
- /// When expanding the reduction PHI, the plan's VF element count is divided
- /// by this factor to form the reduction phi's VF.
- unsigned VFScaleFactor = 1;
+ /// The scaling factor, relative to the VF, that this recipe's output is
+ /// divided by.
+ /// For outer-loop reductions this is equal to 1.
+ /// For in-loop reductions this is equal to 0, to specify that this is equal
+ /// to the VF (which may not be known yet). For partial-reductions this is
+ /// equal to another scalar value.
+ unsigned VFScaleFactor;
----------------
huntergr-arm wrote:
I would prefer not to overload the meaning of this variable, and keep IsInLoop
semantically separate from the scale factor for partial reductions.
I wonder if a variant with empty types would help here, something like:
```
struct RdxOrderedInLoop {};
struct RdxInLoop {};
struct RdxNormal {};
struct RdxPartial {
unsigned VFScaleFactor;
};
std::variant<RdxOrderedInLoop, RdxInLoop, RdxNormal, RdxPartial> RdxStyle;
```
That way we can remove the separate boolean flags and asserts that they are
consistent, and we don't need to overload the meaning of the scale factor.
(I checked that this has been used elsewhere in the codebase; there's a couple
places so far, but LockFileManager.h has the best example).
@fhahn any objections?
https://github.com/llvm/llvm-project/pull/147513
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits