[PATCH] D57779: [SLP] Add support for throttling.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 09:50:31 PST 2020

ABataev added inline comments.

Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3432-3434
+        auto *UserInst = cast<Instruction>(U);
+        if (!UserInst)
+          continue;
Either just `cast` without `if` or `dyn_cast`

Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4290
+  auto Cmp = [](const TreeEntry *LHS, const TreeEntry *RHS) {
+    return LHS->Cost > RHS->Cost;
+  };
Not sure that this is the best criterion. I think you also need to include the distance from the head of the tree to the entry, because some big costs can be compensated by the vectorizable nodes in the tree.
What I would do here is just some kind of level ordering search (BFS) starting from the deepest level.

Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4297
+        Entry->State != TreeEntry::ScatterVectorize) || Entry->Cost <= 0 ||
+        !Entry->Idx)
+      continue;
I think you can also exclude entries with the number of operands <= 1.



More information about the llvm-commits mailing list