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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 04:26:35 PDT 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2841-2844
+        if (!llvm::any_of(VL, [&](Value *S) { return Op == S; })) {
+          assert(!FirstInsert && "FirstInsert already found?");
+          FirstInsert = IE;
+        }
----------------
The first insert has undef vector operand, no?
Plus, this has n^2 complexity


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2858-2869
+        // Reschedule bundle instructions, sorting them by def-to-use order
+        ScheduleData *FirstInBundle = BS.getScheduleData(FirstInsert);
+        ScheduleData *Current = BS.getScheduleData(LastInsert);
+        ScheduleData *NextInBundle = nullptr;
+        do {
+          Current->FirstInBundle = FirstInBundle;
+          Current->NextInBundle = NextInBundle;
----------------
This really looks ugly. Why you can't use the existing functionality?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4216-4223
+      auto *SD = BlocksSchedules[IEI->getParent()]->getScheduleData(EU.Scalar);
+      if (SD->NextInBundle != nullptr) {
+        SmallVector<int> Mask(getTreeEntry(EU.Scalar)->Scalars.size(), -1);
+        ScheduleData *Current = SD->FirstInBundle;
+        do {
+          Mask[Current->Lane] = Current->Lane;
+          Current = Current->NextInBundle;
----------------
Same, looks ugly


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