[FunctionAttrs] Identify norecurse functions
authorJames Molloy <james.molloy@arm.com>
Thu, 12 Nov 2015 08:53:04 +0000 (08:53 +0000)
committerJames Molloy <james.molloy@arm.com>
Thu, 12 Nov 2015 08:53:04 +0000 (08:53 +0000)
commit31d4df2fc68a767980df1d7314d927615aaba1cc
tree2f2d6ade4004a22e80d6d01f7d0958068c046f38
parentc65ca6797f951b6c8b113aa234ab42e0a6d5a3d3
[FunctionAttrs] Identify norecurse functions

A function can be marked as norecurse if:
  * The SCC to which it belongs has cardinality 1; and either
    a) It does not call any non-norecurse function. This includes self-recursion; or
    b) It only has one callsite and the function that callsite is within is marked norecurse.

a) is best propagated bottom-up and b) is best propagated top-down.

We build up the norecurse attributes bottom-up using the existing SCC pass, and mark functions with no obvious recursion (but not provably norecurse) to sweep later, top-down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252862 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/FunctionAttrs.cpp
test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
test/Transforms/FunctionAttrs/atomic.ll
test/Transforms/FunctionAttrs/norecurse.ll [new file with mode: 0644]
test/Transforms/FunctionAttrs/optnone.ll