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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 06:51:14 PDT 2020


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3304
+        LLVM_DEBUG(dbgs() << "SLP: Checking user:" << *U << ".\n");
+        TreeEntry *UserTE = getTreeEntry(U);
+        if (UserTE && UserTE->State != TreeEntry::ProposedToGather)
----------------
What if the user does not have corresponding tree entry, i.e. it is initially scalar? What if the `Scalar` itself is going to remain scalar?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4101-4108
+    for (Value *V : Entry->Scalars) {
+      auto *Inst = cast<Instruction>(V);
+      if (llvm::any_of(Inst->users(), [this](User *Op){ return Tree->ScalarToTreeEntry.count(Op) > 0; })) {
+          NeedGather = true;
+      }
+    }
+    if (NeedGather)
----------------
Just:
```
    for (Value *V : Entry->Scalars) {
      auto *Inst = cast<Instruction>(V);
      if (llvm::any_of(Inst->users(), [this](User *Op){ return Tree->ScalarToTreeEntry.count(Op) > 0; }))
          return InsertCost + getEntryCost(Entry);
    }

```
Also, check code formatting


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

https://reviews.llvm.org/D57779



More information about the llvm-commits mailing list