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

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 08:01:22 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});
+      continue;
+    }
+    StoreLanes.push_back({SI, SI->getValueOperand(), 0, 0,
+                          /*IsVectorLane=*/false});
----------------
yxsamliu wrote:

done

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


More information about the llvm-commits mailing list