Fix thunk&alias issues

Jan Hubicka hubicka@ucw.cz
Sun Oct 16 10:33:00 GMT 2011


Hi,
this patch makes cgrpahunit to output all thunks and aliases after the function,
not before.  Outputting before leads to better code layout and we might omit
tailjump when thunk is just one, but it breaks one pass assembler and comdat
group symbols.

This is the easiest fix and I will play with that incrementally - at the moment
I would like to push the bugs realed to aliases down so I can finally proceed on
the rest of alias reorg (i.e. elimination of alias pairs from backend)

Bootstrapped/regtested and comitted.

Honza

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 180052)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2011-10-15  Jan Hubicka  <jh@suse.cz>
+
+	PR target/48668
+	PR target/50689
+	* cgraphunit.c (cgraph_expand_function): Expand thunks and alises
+	after function body.
+
 2011-10-15  Richard Henderson  <rth@redhat.com>
 
 	* tree-vect-slp.c: Include langhooks.h.
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 180052)
+++ cgraphunit.c	(working copy)
@@ -1798,7 +1798,6 @@ cgraph_expand_function (struct cgraph_no
 
   announce_function (decl);
   node->process = 0;
-  assemble_thunks_and_aliases (node);
   gcc_assert (node->lowered);
 
   /* Generate RTL for the body of DECL.  */
@@ -1808,6 +1807,14 @@ cgraph_expand_function (struct cgraph_no
   gcc_assert (TREE_ASM_WRITTEN (decl));
   current_function_decl = NULL;
   gcc_assert (!cgraph_preserve_function_body_p (node));
+
+  /* It would make a lot more sense to output thunks before function body to get more
+     forward and lest backwarding jumps.  This is however would need solving problem
+     with comdats. See PR48668.  Also aliases must come after function itself to
+     make one pass assemblers, like one on AIX happy.  See PR 50689.
+     FIXME: Perhaps thunks should be move before function IFF they are not in comdat
+     groups.  */
+  assemble_thunks_and_aliases (node);
   cgraph_release_function_body (node);
   /* Eliminate all call edges.  This is important so the GIMPLE_CALL no longer
      points to the dead function body.  */



More information about the Gcc-patches mailing list