[PATCH] D57144: [SLPVectorizer] Get rid of IndexQueue array from vectorizeStores. NFCI.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 06:30:22 PST 2019


ABataev added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4749
 
+  auto FindConsecutiveAccess = [&] (int K, int Idx) {
+    if (!isConsecutiveAccess(Stores[K], Stores[Idx], *DL, *SE))
----------------
1. Use `auto &&`.
2. Do not use default capture, better to use explicit capture list.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4767
     // candidate create the best chance to find slp vectorization opportunity.
-    unsigned Offset = 1;
-    unsigned Cnt = 0;
-    for (unsigned J = 0; J < E - 1; ++J, ++Offset) {
-      if (Idx >= Offset) {
-        IndexQueue[Cnt] = Idx - Offset;
-        ++Cnt;
-      }
-      if (Idx + Offset < E) {
-        IndexQueue[Cnt] = Idx + Offset;
-        ++Cnt;
-      }
-    }
-
-    for (auto K : IndexQueue) {
-      if (isConsecutiveAccess(Stores[K], Stores[Idx], *DL, *SE)) {
-        Tails.insert(Stores[Idx]);
-        Heads.insert(Stores[K]);
-        ConsecutiveChain[Stores[K]] = Stores[Idx];
+    for (int Offset = 1; Offset < E; ++Offset)
+      if ((Idx >= Offset && FindConsecutiveAccess(Idx - Offset, Idx)) ||
----------------
`Offset < E` is too much here, better to use `max(Idx + 1, E - Idx)` as the limit


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57144





More information about the llvm-commits mailing list