[PATCH] D14228: [FunctionAttrs] Identify norecurse functions
Manman Ren via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 4 13:30:19 PST 2015
manmanren 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())
----------------
joker.eph wrote:
> 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?
I was talking about what is actually implemented. But it is not the necessary condition.
// For a function not to recurse, it must be in its own SCC and must not
// call itself or any function that may be recursive.
is incorrect.
But this makes sense:
// We mark a function as norecurse if it is in its own SCC and it does not call itself
// or any function that may be recursive.
Repository:
rL LLVM
http://reviews.llvm.org/D14228
More information about the llvm-commits
mailing list