[PATCH] D91325: [IndVarSimplify] Notify top most loop to drop cached exit counts

guopeilin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 22:07:47 PST 2020


guopeilin added a comment.

Yse, So I use `forgetTopmostLoop()` after `optimizeLoopExits` directly, I think it's more concise.

In D91325#2396652 <https://reviews.llvm.org/D91325#2396652>, @mkazantsev wrote:

> Thanks for explaining, I didn't realize we end up having wrong exact exit count.
>
> I agree with the motivation, but I think that the fix should be unconditional drop of caches in the end of `optimizeLoopExits` if `Changed == true`.





================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1425
+    // ExitCount has been changed.
+    Loop *Parent = L->getParentLoop();
+    bool HasSharedExit = false;
----------------
mkazantsev wrote:
> This whole logic is completely expensive as it visits the exit blocks multiple times. Why not just call `forgetTopmostLoop(L)`?
The reason why I chose to visit exit blocks is that I think it would be expensive if we drop out all cached value for those nested loops that do not share exiting BB.


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

https://reviews.llvm.org/D91325



More information about the llvm-commits mailing list