[llvm] [SLP] Split blocking build-vector stores in scalar chains (PR #194970)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 22:03:02 PDT 2026


================
@@ -27205,6 +27123,24 @@ bool SLPVectorizerPass::vectorizeStores(
     ArrayRef<StoreInst *> Stores, BoUpSLP &R,
     DenseSet<std::tuple<Value *, Value *, Value *, Value *, unsigned>>
         &Visited) {
+  // Convert the collected stores into scalar lanes before building store-chain
+  // contexts. This keeps normal scalar stores and simple build-vector stores in
+  // one address-ordered model.
+  SmallVector<StoreLane> StoreLanes;
+  for (StoreInst *SI : Stores) {
+    SmallVector<Value *, 16> Elts;
+    SmallVector<Instruction *, 16> Insts;
+    if (collectBuildVector(SI->getValueOperand(), Elts, Insts)) {
+      for (auto [Idx, V] : enumerate(Elts))
+        StoreLanes.push_back({SI, V, static_cast<int64_t>(Idx),
+                              static_cast<unsigned>(Idx),
+                              /*IsVectorLane=*/true});
----------------
alexey-bataev wrote:

```suggestion
        StoreLanes.emplace_back(SI, V, static_cast<int64_t>(Idx),
                              static_cast<unsigned>(Idx),
                              /*IsVectorLane=*/true);
```

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


More information about the llvm-commits mailing list