[llvm] [VPlan] Skip uses-scalars restriction if one of ops needs broadcast. (PR #168246)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 01:45:09 PST 2025


================
@@ -1425,32 +1425,33 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
         continue;
       }
 
-      // Skip recipes that aren't single scalars or don't have only their
-      // scalar results used. In the latter case, we would introduce extra
-      // broadcasts.
+      // Skip recipes that aren't single scalars or when conversion to
+      // single-scalar does not introduce additional broadcasts. That is, either
+      // only the scalars of the recipe are used, or at least one of the
+      // operands would require a broadcast. In the latter case, the
+      // single-scalar may need to be broadcasted, but another broadcast is
+      // removed. scalar results used. In the latter case, we would introduce
+      // extra broadcasts.
       if (!vputils::isSingleScalar(RepOrWidenR) ||
----------------
artagnon wrote:

Could split this case out with an early continue?

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


More information about the llvm-commits mailing list