[llvm] [VPlan] Use VPInstruction for uniform binops. (PR #141429)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat May 31 13:32:57 PDT 2025
================
@@ -876,6 +876,9 @@ class VPInstruction : public VPRecipeWithIRFlags,
public VPUnrollPartAccessor<1> {
friend class VPlanSlp;
+ /// True if the VPInstruction produces a single scalar value.
+ bool IsSingleScalar;
----------------
fhahn wrote:
> Should single-scalar rely on similar analysis with only initial VPValues, and recipes that change it (vector to scalar reduction and extraction, broadcast and build steps), know about it?
I think in some cases it can also be seens as property of the producer (e.g. if we proved uniformity for the VF for the specific operation + operands). In those cases, whether a single scalar is produced doesn't depend on either users or operands (e.g. adding a new wide user doesn't change what is produced by the recipe).
I think contrary to scalar types, whether the result is a single scalar is currently queried in many more places during various transforms and would be needed when executing each VPInstruction.
The proposed patch would allow us to start the transition by using a similiar field to current VPReplicateRecipe and hence simplify VPReplicateRecipe to only handle the replicating case.
Similarly we could also use VPInstruction for various VPWiden*Recipes.
It might be worth consolidating and simplifying the existing recipe classes first, before adjusting how we reason/represent single-scalar/uniformity?
https://github.com/llvm/llvm-project/pull/141429
More information about the llvm-commits
mailing list