[llvm] [SLP] Initial support for masked stores (PR #204893)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 11:56:45 PDT 2026


================
@@ -9158,9 +9223,12 @@ void BoUpSLP::reorderTopToBottom() {
                "Expected empty reorder sequence.");
         reorderScalars(TE->Scalars, Mask);
       }
-      if (!TE->ReuseShuffleIndices.empty()) {
+      if (!TE->ReuseShuffleIndices.empty() &&
+          TE->State != TreeEntry::ExpandVectorize) {
         // Apply reversed order to keep the original ordering of the reused
-        // elements to avoid extra reorder indices shuffling.
+        // elements to avoid extra reorder indices shuffling. An ExpandVectorize
+        // store keeps its expand mask fixed and carries the reorder in
+        // ReorderIndices, so it is excluded here.
----------------
bababuck wrote:

Should we allow combing a shuffle mask with `ReorderIndices`? e.g.
```
load <4 x i32>
shuffle %load, <4 x i32> %mask1
add %shuffle, <4 x i32> zeroinit
shuffle %add, <8 x i32> %wide_mask
store <8 x i32>
```
to
```
load <4 x i32>
add %shuffle, <4 x i32> zeroinit
shuffle %add, <8 x i32> %wide_mask_combined
store <8 x i32>
```

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


More information about the llvm-commits mailing list