[PATCH] D74691: [Attributor] Detect possibly unbounded cycles in functions

omar ahmed via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 8 16:31:23 PDT 2020


omarahmed updated this revision to Diff 249021.
omarahmed added a comment.

Patch updates :

Check If LoopInfo and SCEV analyses are available, then:

- We can test whether there is irreducible control (i.e. non-loop cycles). If there is, one of those cycles can be infinite, so we return true.
- Otherwise, loop through all the loops in the function (including child loops) and test whether any of those does not have a maximal trip count (in which case it might be infinite).

Else if unavailable:

- We check if any cycle exists then we return true or else we return false.we use scc_iterator to check for cycles.

Note:

- scc_iterator uses Tarjan, which finds all the maximal SCCs. Those are SCCs which are as big as they can get. i.e. in which you can't put any other node and still have an SCC. To detect if there's a cycle, you only need to find the maximal ones.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74691

Files:
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
  llvm/test/Transforms/Attributor/willreturn.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74691.249021.patch
Type: text/x-patch
Size: 16770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200308/a28c4c68/attachment.bin>


More information about the llvm-commits mailing list