[llvm] [SLP] Avoid seeding related affine loop address computations (PR #226220)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 09:48:52 PDT 2026


================
@@ -36569,13 +36575,22 @@ bool SLPVectorizerPass::vectorizeOnceUsedSeeds(BasicBlock *BB, BoUpSLP &R) {
   SmallDenseMap<std::pair<size_t, size_t>, unsigned> KeyToGroup;
   SmallDenseMap<Value *, unsigned> SeedGroups;
   PoorThroughputOpCache PoorThroughputCache;
+  SmallPtrSet<Value *, 16> IndexedGEPsInBB;
+  if (auto It = IndexedGEPs.find(BB); It != IndexedGEPs.end())
+    for (Value *GEP : It->second)
+      if (GEP)
+        IndexedGEPsInBB.insert(GEP);
   for (Instruction &I : make_filter_range(*BB, [&](Instruction &I) {
          return !R.isDeleted(&I) && I.hasOneUse() && !R.isEphemeralValue(&I) &&
                 !R.isVectorized(&I) && !R.isAnalyzedScalar(&I) &&
                 isValidElementType(getValueType(&I, SLPReVec), SLPReVec) &&
                 isOnceUsedSeed(&I) && !isNonVectorizableInst(&I, TLI) &&
                 !R.hasResolvedUser(&I);
        })) {
+    // Index chains of collected GEPs are handled by vectorizeGEPIndices.
+    if (GetElementPtrInst *GEP = getIndexChainGEP(&I);
+        GEP && GEP->getParent() == BB && IndexedGEPsInBB.contains(GEP))
+      continue;
----------------
alexey-bataev wrote:

```suggestion
```

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


More information about the llvm-commits mailing list