[llvm] [VPlan] Introduce chainUsesScalarValues (PR #158377)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 01:20:57 PDT 2025
================
@@ -1322,15 +1322,11 @@ 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.
+ // Only consider recipes that are single scalars whose scalar value is
+ // used by the final leaves in a recipe-chain walk: if the final leaves
+ // don't use the scalar value, it could introduce extra broadcasts.
if (!vputils::isSingleScalar(RepOrWidenR) ||
- !all_of(RepOrWidenR->users(), [RepOrWidenR](const VPUser *U) {
- return U->usesScalars(RepOrWidenR) ||
- match(cast<VPRecipeBase>(U),
- m_ExtractLastElement(m_VPValue()));
- }))
+ !vputils::chainUsesScalarValues(RepOrWidenR))
----------------
artagnon wrote:
We are iterating backwards through the VPBB, but there is no way to narrow certain Widen-like recipes, as they don't have an underlying value (eg. WidenCast might not have an underlying value). The VPI/Store handling in chainUsesScalarValues is also necessary.
https://github.com/llvm/llvm-project/pull/158377
More information about the llvm-commits
mailing list