[PATCH] Optimization for walk_tree

Jeffrey A Law law@cygnus.com
Wed Jun 21 09:05:00 GMT 2000

  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.

  > 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?

I'd much perfer to keep code simple, except in those cases where there is
a measurable performance impact for making the code more complex.

More information about the Gcc-patches mailing list