[PATCH] D98714: [SLP] Add insertelement instructions to vectorizable tree

Anton Afanasyev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 14 04:24:57 PDT 2021


anton-afanasyev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2878-2879
+        VL0 = cast<Instruction>(VL[0]);
+        Bundle = BS.tryScheduleBundle(VL, this, S);
+        assert(Bundle && "Bundle isn't scheduled after reordering?");
+      }
----------------
ABataev wrote:
> Why do we need to do this tricky stuff?
Why do we need to rearrange `VL`? We make def-use order for this to correctly extract scalars used out-of-tree.

We can get rid of rescheduling here by two ways:
1) Sort `VL` _before_ scheduling, at the beginning of `buildTree_rec()`;
2) Don't sort `VL` at all (use index order made by `findBuildAggregate()` and recover this order every time again when needed.

I'm to try 2) way here.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4005
   if (VectorizableTree[0]->State == TreeEntry::Vectorize &&
+      !isa<InsertElementInst>(VectorizableTree[0]->Scalars[0]) &&
       (allConstant(VectorizableTree[1]->Scalars) ||
----------------
ABataev wrote:
> Do you still need this?
Yes, still need. Moved this to separate block to be more clear.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98714



More information about the llvm-commits mailing list