[llvm] [VPlan] Permit more users in narrowToSingleScalars (PR #166559)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 04:26:05 PST 2025


================
@@ -1419,10 +1419,22 @@ static void narrowToSingleScalarRecipes(VPlan &Plan) {
       // broadcasts.
       if (!vputils::isSingleScalar(RepOrWidenR) ||
           !all_of(RepOrWidenR->users(), [RepOrWidenR](const VPUser *U) {
-            return U->usesScalars(RepOrWidenR) ||
-                   match(cast<VPRecipeBase>(U),
-                         m_CombineOr(m_ExtractLastElement(m_VPValue()),
-                                     m_ExtractLastLanePerPart(m_VPValue())));
+            if (auto *Store = dyn_cast<VPWidenStoreRecipe>(U)) {
+              // The assert must hold as we checked the RepOrWidenR operand
+              // against vputils::isSingleScalar.
+              assert(RepOrWidenR == Store->getAddr() ||
+                     vputils::isSingleScalar(Store->getStoredValue()));
+              return true;
+            }
----------------
artagnon wrote:

Oh, right: I missed the reverse-order in my reasoning. Maybe we should work on a follow-up to narrow widen-stores?

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


More information about the llvm-commits mailing list