Avoid tree-tailcall upsetting tree-inline

Richard Guenther richard.guenther@gmail.com
Sat Jan 20 11:17:00 GMT 2007


On 1/20/07, Jan Hubicka <jh@suse.cz> wrote:
> Hi,
> the tailrecursion-5.c optimization fails with Razya's IP constant propagation
> patch and also with -O3.  The problem is caused by tail recursion seeing:
>
> return (result_decl = var);
>
> and to increase result_decl by accumulator, it does somewhat zelaous conversion:
>
> result_decl = var;
> acc = result_decl + other_acc;
> return acc
>
> so now result_decl is used as temporary but actually not used for returning.
> This upsets inliner that does expect result_decl to either not exist or be used
> for returning.  The attached patch makes tree-tailcall to rewrite it as:
>
> acc = var + other_acc
> return (result_decl = acc);
>
> Bootstrapped/regtested i686-linux (without fortran as fortran is broken currently)
> OK? (might do c/fortran run before comitting).

This is ok.

Thanks,
Richard.

> Honza
>         * tree-tailcall.c (adjust_return_value): Do not use RESULT_DECL
>         as temporary.



More information about the Gcc-patches mailing list