This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re-enable tail call optimization
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com, dnovillo at redhat dot com
- Date: Wed, 26 Nov 2003 13:53:19 +0100
- Subject: Re-enable tail call optimization
Hi,
tail call optimization no longer reproduces any failures on i686, i386
nor x86_64.
The patch also reorders tail call discovery and mustalias so we take
advantage of & operands optimized out.
OK?
2003-11-21 Jan Hubicka <jh@suse.cz>
* tree-dump.c (dump_files): Reorder tailcall and mustalias
* tree.h (tree_dump_index): Likewise.
* tree-optimize.c (optimize_function_tree): Do tail call after mustalias.
Index: tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.6.2.55
diff -c -3 -p -r1.6.2.55 tree-dump.c
*** tree-dump.c 20 Nov 2003 20:54:39 -0000 1.6.2.55
--- tree-dump.c 21 Nov 2003 20:30:48 -0000
*************** static struct dump_file_info dump_files[
*** 664,671 ****
{".dom1", "tree-dom1", 0, 0},
{".ssa2", "tree-ssa2", 0, 0},
{".dce1", "tree-dce1", 0, 0},
- {".tail", "tree-tail", 0, 0},
{".mustalias", "tree-mustalias", 0, 0},
{".ssa3", "tree-ssa3", 0, 0},
{".sra", "tree-sra", 0, 0},
{".ssa4", "tree-ssa4", 0, 0},
--- 664,671 ----
{".dom1", "tree-dom1", 0, 0},
{".ssa2", "tree-ssa2", 0, 0},
{".dce1", "tree-dce1", 0, 0},
{".mustalias", "tree-mustalias", 0, 0},
+ {".tail", "tree-tail", 0, 0},
{".ssa3", "tree-ssa3", 0, 0},
{".sra", "tree-sra", 0, 0},
{".ssa4", "tree-ssa4", 0, 0},
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.78
diff -c -3 -p -r1.1.4.78 tree-optimize.c
*** tree-optimize.c 20 Nov 2003 21:21:44 -0000 1.1.4.78
--- tree-optimize.c 21 Nov 2003 20:30:48 -0000
*************** optimize_function_tree (tree fndecl, tre
*** 117,127 ****
if (flag_tree_dce)
tree_ssa_dce (fndecl, TDI_dce_1);
- #if 0
- /* Eliminate tail recursion calls. */
- tree_optimize_tail_calls (false, TDI_tail1);
- #endif
-
/* The must-alias pass removes the aliasing and addressability bits
from variables that used to have their address taken. */
if (flag_tree_must_alias)
--- 117,122 ----
*************** optimize_function_tree (tree fndecl, tre
*** 133,138 ****
--- 128,136 ----
if (sbitmap_first_set_bit (vars_to_rename) >= 0)
rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_3);
}
+
+ /* Eliminate tail recursion calls. */
+ tree_optimize_tail_calls ();
/* Scalarize some structure references. */
if (flag_tree_sra)
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.135
diff -c -3 -p -r1.342.2.135 tree.h
*** tree.h 20 Nov 2003 20:54:39 -0000 1.342.2.135
--- tree.h 21 Nov 2003 20:30:49 -0000
*************** enum tree_dump_index
*** 3563,3570 ****
TDI_dom_1,
TDI_ssa_2,
TDI_dce_1,
- TDI_tail, /* dump after tail recursion elimination */
TDI_mustalias,
TDI_ssa_3,
TDI_sra,
TDI_ssa_4,
--- 3563,3570 ----
TDI_dom_1,
TDI_ssa_2,
TDI_dce_1,
TDI_mustalias,
+ TDI_tail, /* dump after tail recursion elimination */
TDI_ssa_3,
TDI_sra,
TDI_ssa_4,