This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] Optimization for walk_tree


On Wed, Jun 21, 2000 at 09:53:25AM -0600, Jeffrey A Law wrote:
> 
>   In message <20000621152315.D474@sunsite.ms.mff.cuni.cz>you write:
>   > Hi!
>   > 
>   > gcc does not recognize 
>   > int foo(void)
>   > {
>   > int r;
>   > do {
>   >   r = foo(void);
>   >   if (r) return r;
>   > } while (0);
>   > return 0;
>   > }
> Well, in function-at-a-time mode we might be able to detect that the loop
> iterates exactly once (and thus isn't a loop).  That in turn would allow for
> the possibility of a tail call optimization.

I think the if (r) return r; ... return 0; is what prevents the tail recursion,
not the loop.

> 
>   > sequence as tail call recursion, and I guess it will take quite some time
>   > till it will. So I think we should help it a little bit in walk_tree to
>   > speed things up a little bit.
> Have you done any profiling which indicated that walk_tree is important?

walk_tree shows up pretty high in profiles, it is e.g. used heavily in
inlining on trees etc. And, one of the things which slow down gcc on SPARC a
lot is that it runs out of register windows all the time because there are
extremely deep function call stacks.
I admit I haven't done any profiling on walk_tree with and without my patch
yet, will try to do that tomorrow.
I'd also like to profile whole gcc for too deep function call stacks on
SPARC and try to do something about it, but I won't be able to get to it in the next
few days.

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]