Sibcall on recursive functions
Andrew Pinski
pinskia@gmail.com
Thu Jan 14 17:08:00 GMT 2010
On Thu, Jan 14, 2010 at 3:12 AM, Paulo J. Matos <pocmatos@gmail.com> wrote:
> Gcc4.3.4 when I compile functions with : -Os -fno-inline-functions
> -fno-inline-small-functions
> calls TARGET_FUNCTION_OK_FOR_SIBCALL for the fact_aux call in facti,
> but it does not call TARGET_FUNCTION_OK_FOR_SIBCALL for the fact_aux
> recursive call, why?
Because it is not really sibcalled but rather turned into a loop via
tail recursion. This is almost always profitable and never changes
how many times the stack gets restored (unless there is an alloca in
the function which is checked for inside the optimization).
Thanks,
Andrew Pinski
More information about the Gcc
mailing list