[Attributor] Detect possibly unbounded cycles in functions
authoromarahmed1111 <omarpirate2010@yahoo.com>
Fri, 13 Mar 2020 15:30:36 +0000 (10:30 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Fri, 13 Mar 2020 16:17:33 +0000 (11:17 -0500)
commitb285b333dcd04dc79cb864e7178d56b74815caec
tree5965ea7959c96e1de5cf33b09364febdea7f7abf
parent5a5a075c5b19b9024f53ecd03460c6e379798893
[Attributor] Detect possibly unbounded cycles in functions

This patch add mayContainUnboundedCycle helper function which checks whether a function has any cycle which we don't know if it is bounded or not.
Loops with maximum trip count are considered bounded, any other cycle not.
It also contains some fixed tests and some added tests contain bounded and
unbounded loops and non-loop cycles.

Reviewed By: jdoerfert, uenoku, baziotis

Differential Revision: https://reviews.llvm.org/D74691
llvm/include/llvm/Analysis/MustExecute.h
llvm/lib/Analysis/MustExecute.cpp
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll
llvm/test/Transforms/Attributor/willreturn.ll