[llvm] [SLP] Collect candidate VFs in vector in vectorizeStores (NFC). (PR #82793)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 06:38:24 PST 2024


================
@@ -13918,10 +13918,14 @@ bool SLPVectorizerPass::vectorizeStores(ArrayRef<StoreInst *> Stores,
                           << "MinVF (" << MinVF << ")\n");
       }
 
-      // FIXME: Is division-by-2 the correct step? Should we assert that the
-      // register size is a power-of-2?
-      unsigned StartIdx = 0;
+      SmallVector<unsigned> CandidateVFs;
       for (unsigned Size = MaxVF; Size >= MinVF; Size /= 2) {
+        // FIXME: Is division-by-2 the correct step? Should we assert that the
+        // register size is a power-of-2?
+        CandidateVFs.push_back(Size);
+      }
----------------
alexey-bataev wrote:

```suggestion
unsigned Sz = MaxVF / MinVF;
SmallVector<unsigned> CandidateVFs(Sz);
// FIXME: Is division-by-2 the correct step? Should we assert that the
// register size is a power-of-2?
unsigned Size = MaxVF;
for_each(Candidate, [&](unsigned &VF) { VF = Size; Size /= 2; });
```

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


More information about the llvm-commits mailing list