[llvm] [SLP][REVEC] reorderNodeWithReuses should not be called if all users of a TreeEntry are ShuffleVectorInst. (PR #118260)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 05:42:00 PST 2024


================
@@ -6073,6 +6073,23 @@ void BoUpSLP::reorderTopToBottom() {
                                      TE->Scalars.size();
                         }) &&
                  "All users must be of VF size.");
+          if (SLPReVec) {
+            assert(SLPReVec && "Only supported by REVEC.");
+            // ShuffleVectorInst does not do reorderOperands (and it should not
+            // because ShuffleVectorInst supports only a limited set of
+            // patterns). Only do reorderNodeWithReuses if all of the users are
+            // not ShuffleVectorInst.
+            if (all_of(TE->UserTreeIndices, [&](const EdgeInfo &EI) {
+                  return isa<ShuffleVectorInst>(EI.UserTE->getMainOp());
+                }))
+              continue;
+            assert(all_of(TE->UserTreeIndices,
+                          [&](const EdgeInfo &EI) {
+                            return !isa<ShuffleVectorInst>(
+                                EI.UserTE->getMainOp());
+                          }) &&
----------------
alexey-bataev wrote:

```suggestion
            assert(none_of(TE->UserTreeIndices,
                          [&](const EdgeInfo &EI) {
                            return isa<ShuffleVectorInst>(
                                EI.UserTE->getMainOp());
                          }) &&
```


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


More information about the llvm-commits mailing list