Small sibbling call tweak
Fergus Henderson
fjh@cs.mu.oz.au
Sun Nov 26 03:24:00 GMT 2000
Hi,
Many thanks to the folks who implemented sibling call optimization!
However, there's still room for improvement. Way back on May 9th,
Jan Hubicka <jh@suse.cz> posted a suggestion:
> The sibbling call sequence is not generated for calls appearing
> lexically inside loops. This is not good idea IMO, since it is
> common practice to have loop with conditional return inside
> such as:
>
> main()
> { while (1) if (q()) return t();
> }
I agree with this. Furthermore, when using macros, it is also very
common to have code enclosed inside `do { ... } while (0)', and the
current code prevents optimization in that case too.
Jan included a patch with his email, and Richard Henderson replied
"OK", but the patch still hasn't been committed. Is there any
reason for this? If not, could someone please commit it?
For reference I enclose the patch below.
Cheers,
Fergus.
----------
Tue May 9 17:13:40 MET DST 2000 Jan Hubicka <jh@suse.cz>
* calls.c (expand_call): Generate sibbling_call sequences
for calls inside lexical loops.
Index: egcs/gcc/calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.131
diff -c -3 -p -r1.131 calls.c
*** calls.c 2000/05/09 14:33:41 1.131
--- calls.c 2000/05/09 15:11:37
*************** expand_call (exp, target, ignore)
*** 2308,2314 ****
if (!flag_optimize_sibling_calls
|| !rtx_equal_function_value_matters
|| currently_expanding_call
- || !stmt_loop_nest_empty ()
|| any_pending_cleanups (1)
|| args_size.var)
try_tail_call = try_tail_recursion = 0;
--- 2308,2313 ----
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh > | -- the last words of T. S. Garp.
More information about the Gcc
mailing list