[PATCH] D104203: [LoopUnroll] Fold all exits based on known trip count/multiple

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 15:39:52 PDT 2021


reames added a comment.

I think there's a problem with this code, but I'm surprised the existing test didn't catch it.  Have you run this with explicit dom tree and loop info validation enabled?

Here's the problem I think I see.  If we have an exit block which exits only on iteration X, and we unroll by count Y where Y > X, I believe we'll end up making the exit block unreachable.  (This can't happen if there's only a single exit since that exit must be reached.)  The problem with an unreachable exit is that there can be arbitrarily complicated loops reachable only through that path, and updating loop info in that case is hard.  Am I missing something here?



================
Comment at: llvm/lib/Transforms/Utils/LoopUnroll.cpp:747
+    if (RuntimeTripCount) {
+      // When runtime unrolling, information about non-latch exits may be
+      // stale.
----------------
This bit doesn't make sense to me, can you explain?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104203



More information about the llvm-commits mailing list