[PATCH] D103382: [LoopDeletion] Consider infinite loops alive, unless mustprogress.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 13:04:17 PDT 2021


nikic added a comment.

> In D103382#2788736 <https://reviews.llvm.org/D103382#2788736>, @nikic wrote:
>
>> This looks okay with one caveat: We could still have an irreducible inner cycle, which will not be represented in LoopInfo. Any thoughts on what to do about that?
>
> Ah yes, I forgot to mentioned that in the description. Irreducible cycles have never been handled properly in loop-deletion, so I think it would make sense to fix that separately. I don't think there's much we can do other than bailing out on functions that contain irreducible control-flow for now. To do that in loop passes we might need a better way to cache the result of the analysis.

Yes, I agree that this should be handled separately.



================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:118-122
+  if (FnMustProgress || hasMustProgress(L))
+    return true;
+
+  if (!LoopFinite(L))
+    return false;
----------------
Apart from FnMustProgress, aren't these checks redundant with the ones in the worklist loop?


================
Comment at: llvm/test/Transforms/LoopDeletion/unreachable-loops.ll:339
 ; REMARKS-LABEL: Function: test9
 ; REMARKS: Loop deleted because it never executes
 entry:
----------------
fhahn wrote:
> nikic wrote:
> > This remark shouldn't be there anymore ... possibly matches a future remark?
> I think there's still a loop removed (`L2`), as the comment indicates.
Oh right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103382



More information about the llvm-commits mailing list