[llvm] [SLP] Relax store chain user limit to 2 (PR #215700)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 11:27:25 PDT 2026
================
@@ -28679,13 +28679,39 @@ SLPVectorizerPass::vectorizeStoreChainImpl(ArrayRef<Value *> Chain, BoUpSLP &R,
// only merges the stores, while the scalars remain live for the other users
// and all the lanes are gathered back. A single outside use may still be a
// part of the larger vectorizable graph, same for the values, fed by the
- // loads, where the vector loads may pay off the gathering.
+ // loads, where the vector loads may pay off the gathering. Two outside uses
+ // may still be part of the same tree when they are local carry deps
+ // (cmp/add in the same block); reject 3+ outside users or 2 non-local
+ // outside users.
+ auto IsBenignOutsideUser = [](Instruction *I, User *U) {
+ auto *UI = dyn_cast<Instruction>(U);
+ if (!UI || UI->getParent() != I->getParent())
+ return false;
+ return isa<CmpInst, BinaryOperator, SelectInst>(UI);
+ };
+ auto HasTooManyOutsideUsers = [&](Instruction *I) {
+ // Cap the walk: more than one store use + two outside users is enough to
+ // reject, so skip values with clearly too many uses.
+ if (I->hasNUsesOrMore(Stores.size() + 3))
----------------
alexey-bataev wrote:
```suggestion
if (I->hasNUsesOrMore(UsesLimit))
```
https://github.com/llvm/llvm-project/pull/215700
More information about the llvm-commits
mailing list