https://github.com/ayalz commented:
> At the moment, some VPInstructions create only a single scalar value, but use > VPTransformatState's 'vector' storage for this value. Those values are > effectively uniform-per-VF (or in some cases uniform-across-VF-and-UF). Using > the vector/per-part storage doesn't interact well with other recipes, that > more accurately using (Part, Lane) to look up scalar values and prevents > VPInstructions creating scalars from interacting with other recipes working > with scalars. > > This PR tries to unify handling of scalars by using (Part, 0) for scalar > values where only the first lane is demanded. This allows using > VPInstructions with other recipes like VPScalarCastRecipe and is also needed > when using VPInstructions in more cases otuside the vector loop region to > generate scalars. > Perhaps it is the "other recipes" who should be fixed, to more consistently store their single scalar in per-part storage rather than lane zero? The current design of State is to hold UF per-part Values whenever possible, be they vectors or (uniform) scalars, and otherwise holds VF*UF per-lane Values, for every VPValue. The hasVectorValue() and hasScalarValue() indicators should better be renamed hasValuePerPart() and hasValuePerLane(), respectively. Unrolling loop-regions in VPlan by UF would simplify State to hold a single per-part Value or VF per-lane Values. Further unrolling replicating-regions and replicating-recipes by VF would simplify State to hold a single Value per VPValue. The current get() functions are overly complex, as they bridge gaps by packing VF scalar elements into a vector on-demand for a scalar producer to feed a vector consumer, by extracting VF scalar elements from a vector producer to feed a scalar-replicating consumer, and more. Introducing explicit pack and extract recipes in VPlan could simplify its code-gen and State, prior to unrollings. https://github.com/llvm/llvm-project/pull/80271 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits