[PATCH] D73058: [LoopRotate] add ability to repeat loop rotation until non-deoptimizing exit is found

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 23:10:51 PST 2020


fedor.sergeev marked 2 inline comments as done.
fedor.sergeev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopRotationUtils.cpp:232
+    return any_of(Exits, [](const BasicBlock *BB) {
+      return !BB->getPostdominatingDeoptimizeCall();
+    });
----------------
skatkov wrote:
> Side comment, May be it makes sense to keep note here in comment.
> As I understand getPostdominatingDeoptimizeCall may return false even if it ends with deopt. Say if you have a loop before deoptimization. In this case there is no need to rotate but we will do.
Yep, situation when all exits are in fact postdominated by calls to deoptimize is possible.
However it is a really degenerate case (every exit is unlikely, so the loop is either unlikely itself or it is an endless loop, thus does not have finite trip-count).
We should not care what we do here.


================
Comment at: llvm/lib/Transforms/Utils/LoopRotationUtils.cpp:570
+    // to handle multiple rotations in one go.
+    rotateLoop(L, false);
+  }
----------------
skatkov wrote:
> Does'not you want to convert this recursion into iteration by moving this code to LoopRotate::processLoop?
Then it makes the patch looking much bigger than it actually is due to lots of whitespace changes.
I'm not sure it is worth the effort.
Perhaps do that separately?
The only benefit is that in loop form it becomes super-easy to limit amount of iterations.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73058





More information about the llvm-commits mailing list