[llvm] [VPlan] Consolidate logic for narrowToSingleScalars (NFC) (PR #167360)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 00:55:06 PST 2025


================
@@ -1418,7 +1394,9 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
       // 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.
-      if (!vputils::isSingleScalar(RepOrWidenR) ||
+      if ((!vputils::isSingleScalar(RepOrWidenR) &&
+           !vputils::onlyFirstLaneUsed(RepOrWidenR)) ||
+          RepOrWidenR->getNumUsers() == 0 ||
----------------
artagnon wrote:

(Sorry, still waking up, so kindly excuse mistakes)

I think the problem is that vputils::onlyFirstLaneUsed returns true for replicate stores, as they have no users, and hence all users use the first lane one only?

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


More information about the llvm-commits mailing list