[PATCH] D60074: [Attributor] Deduce "no-recurse" function attribute
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 1 10:41:44 PDT 2019
jdoerfert created this revision.
jdoerfert added reviewers: homerdin, hfinkel, fedor.sergeev, sanjoy, spatel, nlopes, nicholas, reames.
Herald added subscribers: bollu, hiraditya.
Herald added a project: LLVM.
jdoerfert added a parent revision: D59918: [Attributor] Pass infrastructure and fixpoint framework.
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
Possible improvements:
- 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60074
Files:
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/FunctionAttrs/arg_returned.ll
llvm/test/Transforms/FunctionAttrs/norecurse.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60074.193120.patch
Type: text/x-patch
Size: 9708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190401/a4f29ef5/attachment.bin>
More information about the llvm-commits
mailing list