[PATCH] D14228: [FunctionAttrs] Identify norecurse functions
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 4 12:08:08 PST 2015
joker.eph added inline comments.
================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1832
@@ +1831,3 @@
+ // For a function not to recurse, it must be in its own SCC and must not
+ // call itself or be callable by external functions.
+ if (!SCC.isSingular())
----------------
manmanren wrote:
> This comment seems to be incorrect. Should it be "must not call itself or any function that may be recursive"?
>
It can call a recursive function, as long at it is not involved in the recursion.
i.e. if:
a() calls b()
b() calls c()
c() calls b()
a is not recursive, but b() and c() are.
The issue with external function is that you don't know if they can call back into a() or one of its callers.
Or did I misunderstand what you meant?
================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1841
@@ +1840,3 @@
+
+ if (std::any_of(CGN->begin(), CGN->end(),
+ [](const CallGraphNode::CallRecord &CR) {
----------------
manmanren wrote:
> reames wrote:
> > If there's a single element in the SCC, why do you need the any_of?
> Here it is checking the edges from the single element in the SCC.
A comment might be useful?
Repository:
rL LLVM
http://reviews.llvm.org/D14228
More information about the llvm-commits
mailing list