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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 10:15:36 PDT 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2624
   // Don't handle vectors.
-  if (S.OpValue->getType()->isVectorTy()) {
+  if (S.OpValue->getType()->isVectorTy() && !isa<InsertElementInst>(VL[0])) {
     LLVM_DEBUG(dbgs() << "SLP: Gathering due to vector type.\n");
----------------
`VL[0]`->`S.OpValue`


================
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?");
+      }
----------------
Why do we need to do this tricky stuff?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2905-2906
+      BS.cancelScheduling(VL, VL0);
+      if (allSameType(Operands) || allConstant(Operands))
+        buildTree_rec(Operands, Depth, UserTreeIdx);
+      return;
----------------
The first check must be always true here, no?


================
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) ||
----------------
Do you still need this?


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