[PATCH] D63046: [Attributor] Deduce "willreturn" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 07:19:22 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1109
+
+// Helper function that checks whether a function has any loop.
+bool containsLoop(Function &F) {
----------------
uenoku wrote:
> nicholas wrote:
> > Loop is commonly assumed to mean "natural loop", where there is one block (the header) which dominates the other blocks in the loop (the loop body). What you're looking for here is a more general thing called a cycle (equivalent to looking for a backedge). That also explains why you need your own function and can't reuse LoopInfo.
> > Loop is commonly assumed to mean "natural loop", where there is one block (the header) which dominates the other blocks in the loop (the loop body). What you're looking for here is a more general thing called a cycle (equivalent to looking for a backedge).
> 
> OK, I rename it.
> 
> > That also explains why you need your own function and can't reuse LoopInfo.
> 
> LoopInfo doesn't contain an irreducible loop (maybe endless loop) so I check the cycle manually for now.
> I'm going to use LoopInfo to check (i) whether a function has an irreducible loop and (ii) whether all loops are guaranteed to terminate.
> 
> 
> I'm going to use LoopInfo to check (i) whether a function has an irreducible loop and (ii) whether all loops are guaranteed to terminate.

Keep it this way for now, LoopInfo will currently not simplify things


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

https://reviews.llvm.org/D63046





More information about the llvm-commits mailing list