[PATCH] D22952: [LoopVectorize] Detect loops in the innermost loop before creating InnerLoopVectorizer

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 10:57:56 PDT 2016


anemet requested changes to this revision.
anemet added a reviewer: anemet.
This revision now requires changes to proceed.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1922-1928
@@ -1845,6 +1921,9 @@
 
-static void addInnerLoop(Loop &L, SmallVectorImpl<Loop *> &V) {
-  if (L.empty())
-    return V.push_back(&L);
+static void addAcyclicInnerLoop(Loop &L, SmallVectorImpl<Loop *> &V) {
+  if (L.empty()) {
+    if (!hasCyclesInLoopBody(L))
+      V.push_back(&L);
+    return;
+  }
 
   for (Loop *InnerL : L)
----------------
It seem to me that nothing prevents us from letting all loops go all the way until Legality.canVectorize().  Then we can check this property as the very first thing in there.

If that does not work we can check this earlier in processLoop.

The part we're missing to report diagnostics in addAcyclicInnerLoop is the Hints which provides the pass name.  Alternatively, we can also construct Hints in addAcyclicInnerLoop.  This is probably the least preferred alternative though because then you need to propagate this back to processLoop.


https://reviews.llvm.org/D22952





More information about the llvm-commits mailing list