[PATCH] D25517: [SLPVectorizer] Improved support of partial tree vectorization.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 06:18:54 PDT 2017


ABataev added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp:4457
+namespace {
+/// Tracks instructons and its children.
+class WeakVHWithLevel final : public CallbackVH {
----------------
anemet wrote:
> Tracks for what?
Traks if the instruction is deleted (replaced by undef value) /replaced by the new instruction (the vector version, as the result of the whole vectorization process) + tracks the processing of the instruction operands


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp:4499-4505
 /// \brief Attempt to reduce a horizontal reduction.
 /// If it is legal to match a horizontal reduction feeding
-/// the phi node P with reduction operators BI, then check if it
-/// can be done.
+/// the phi node P with reduction operators Root in a basic block BB, then check
+/// if it can be done.
 /// \returns true if a horizontal reduction was matched and reduced.
 /// \returns false if a horizontal reduction was not matched.
+static bool canBeVectorized(
----------------
anemet wrote:
> The name of the function and the comment mismatch.  What is this function supposed to do?
Yes, probably. This function checks if it is possible to vectorize the tree + performs the vectorization of horizontal reduction or, if the instruction is not the top instruction of the horizontal reduction and this is a binary operation, vectorizes the operands of this binary instruction.


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp:4517-4573
+  SmallVector<WeakVHWithLevel, 8> Stack(1, Root);
+  SmallSet<Value *, 8> VisitedInstrs;
+  bool Res = false;
+  while (!Stack.empty()) {
+    Value *V = Stack.back();
+    if (!V) {
+      Stack.pop_back();
----------------
anemet wrote:
> This needs a description of the algorithm.
The algorithm is the same as before, just exit criteria become a bit weaker.


Repository:
  rL LLVM

https://reviews.llvm.org/D25517





More information about the llvm-commits mailing list