Deduce the "no-recurse" function attribute through "backward-reasoning".
Thus, if no call site in the function may cause recursion, the function
does not recurse. Note that "backward-reasoning" is the only reasoning
the Attributor performs right now.
Impact on the statistics (-stats) for LLVM-TS + Spec2006, totaling
almost 80% more localized globals (probably due to the intrinsic
white list used).
CHANGED: attributor NumAttributesManifested 612 -> 14331 ( +2241.667%) CHANGED: attributor NumAttributesValidFixpoint 26069 -> 39788 ( +52.626%) ADDED: attributor NumFnNoRecurse n/a -> 13719 CHANGED: functionattrs NumNoRecurse 61932 -> 49305 ( -20.388%) CHANGED: globalopt NumLocalized 37 -> 66 ( +78.378%)
Note: Missing "no-recurse" deduction compared to functionattrs is
completely, or at least in large parts, due to a bug in the existing code, see: https://llvm.org/PR41336
- Perform "forward-reasoning": If all call sites are in no-recurse functions then the function musst be no-recurse.
- Eliminate dead call sites: Similar to the preliminary reasoning in the no-return abstract attribute we can ignore dead call sites.