[llvm] [VPlan] Permit more users in narrowToSingleScalars (PR #166559)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 06:44:39 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:
Hm, see https://godbolt.org/z/3hTncGMfx -- I think a different way to vectorize this would be to insert a broadcast for x? I don't think extra broadcasts will be generated in any case, and that the broadcast will just be moved? There is obviously no diff with the patch, but do you think I should include this test?
https://github.com/llvm/llvm-project/pull/166559
More information about the llvm-commits
mailing list