[llvm] [VPlan] Use VPInstruction for uniform binops. (PR #141429)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 31 01:15:31 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;
----------------
ayalz wrote:

Being single scalar is conceptually part of a VPValue's type, complementing its element type. A non single scalar value is either a vector of VF (fixed, scalable, EVL) elements or a collection of VF scalars, which may also deserve clear indication(?), potentially extended in the future to support other widths considering SLP starting with interleave groups, mixed vectorization, etc.

VPlan keeps VPValues agnostic of their Type, relying on VPTypeAnalysis to infer the element type, taking care of caching it. Only recipes that change their type contain that information, as in VPInstructionWithType casts, loads, calls, and initial VPValues. Narrowing bit widths introduces such casts to convey newly inferred element types.

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?

https://github.com/llvm/llvm-project/pull/141429


More information about the llvm-commits mailing list