[llvm] [SLP]Vectorize single-user instructions as the last-attempt seeds (PR #212579)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 11:52:39 PDT 2026


================
@@ -10028,6 +10067,15 @@ static SeedGroupKey getSeedGroupKey(const Instruction *I,
 }
 } // namespace
 
+/// Returns true if the role of \p I is already decided by its user: a deleted
+/// user was folded into some other vector by an earlier attempt.
+static bool hasResolvedUser(Instruction *I, const BoUpSLP &R) {
+  return any_of(I->users(), [&](User *U) {
+    auto *UI = dyn_cast<Instruction>(U);
+    return UI && (R.isDeleted(UI) || R.isVectorized(UI));
----------------
bababuck wrote:

```suggestion
  return any_of(I->users(), [&](User *U) {
    auto *UI = dyn_cast<Instruction>(U);
    return UI && R.isDeleted(UI);
```
I think `R.isVectorized` ought to be removed. This function seems to only be called during seed collection, at which point any values left in `VectorizableTree` are just residual and likely just reflect past failed vectorization attempts. 

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


More information about the llvm-commits mailing list