[PATCH] D114101: [SLP]Improve analysis/emission of vector operands for alternate nodes.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 24 05:19:48 PST 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5027
+      // main/alternate ops.
+      auto &&ExistMatchingNode = [this, E]() {
+        for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {
----------------
vporpo wrote:
> I think a better place for this function is in BoUpSLP, there are methods that search the tree entries there, like `findReusedOrderedScalars(TE)`.
I don't want to add an extra member function to keep the interface and contract of the class as simple as possible. Currently, we have just a single user for this functor, If we'll need to use in other places, I'll transform it into a member function.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5032-5041
+              TE->getNumOperands() == E->getNumOperands() &&
+              ((TE->getOpcode() == E->getOpcode() &&
+                TE->getAltOpcode() == E->getAltOpcode()) ||
+               (TE->getOpcode() == E->getAltOpcode() &&
+                TE->getAltOpcode() == E->getOpcode()))) {
+            for (unsigned I = 0, End = E->getNumOperands(); I < End; ++I) {
+              if (TE->getOperand(I) != E->getOperand(I))
----------------
vporpo wrote:
> Could you place these checks in a method in `TreeEntry`? Perhaps as an `operator==()` ?
Will try but not sure we can represent it as `operator==()`. It is not an equality of the entries themselves, it is about equality of the operands.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114101/new/

https://reviews.llvm.org/D114101



More information about the llvm-commits mailing list