[PATCH] D93317: [LV] Vectorize (some) early and multiple exit loops

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 09:24:51 PST 2020


reames marked 8 inline comments as done.
reames added a comment.

Ayal, thanks for all the great wordsmith comments!

Florian, I can confirm the crash with your test case, will investigate.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1558
+    // iteration in scalar form.
+    if (!TheLoop->getExitingBlock() || !TheLoop->isRotatedForm())
+      return true;
----------------
Ayal wrote:
> Checking that the only exit is the latch can be done (alternatively, literally) by
> `if (TheLoop->getExitingBlock() == TheLoop->getLoopLatch())`
I went ahead and switched since you seem to have a preference, but in general, these are not the same.  Consider an infinite loop with two latch blocks.  Such a loop can't reach here, but it requires context to know that.  The form of the check I used is context free.  

Doesn't really matter here, so I'll go with your preference.


================
Comment at: llvm/test/Transforms/LoopVectorize/loop-legality-checks.ll:24
-}
-
 ; Make sure LV legal bails out when there is no exiting block
----------------
Ayal wrote:
> Would it be useful to keep this (single exiting, double latched(?)) test?
Oh, I'd missed the fact this was a double latch, not just a non exiting latch.  I'll add a test for that case in loop-form.ll along with the others and rebase.


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

https://reviews.llvm.org/D93317



More information about the llvm-commits mailing list