public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix gimple thunks
@ 2013-09-07  8:15 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2013-09-07  8:15 UTC (permalink / raw)
  To: gcc-patches

Hi,
this is a variant of patch I tested and comitted after discussion on DECL_ARGUMENTS change.
Basically ARGUMENTS are now part of a functio nbody and we need to stream them for thunks
in order to be able to expand them.  The patch also fixes misplaced pop_cfun in lto-streamer-in.c.

Bootstrapped/regtested x86_64-linux, comitted.

	* cgraphunit.c (expand_thunk): Get body before touching arguments.
	* lto-streamer-out.c: Stream thunks, too.
	* lto-streamer-in.c (input_function): Pop cfun here
	(lto_read_body): Instead of here.
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 202335)
+++ cgraphunit.c	(working copy)
@@ -1433,7 +1433,11 @@ expand_thunk (struct cgraph_node *node)
   tree virtual_offset = NULL;
   tree alias = node->callees->callee->symbol.decl;
   tree thunk_fndecl = node->symbol.decl;
-  tree a = DECL_ARGUMENTS (thunk_fndecl);
+  tree a;
+
+  if (in_lto_p)
+    cgraph_get_body (node);
+  a = DECL_ARGUMENTS (thunk_fndecl);
 
   current_function_decl = thunk_fndecl;
 
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 202335)
+++ lto-streamer-out.c	(working copy)
@@ -1985,8 +1985,7 @@ lto_output (void)
       cgraph_node *node = dyn_cast <cgraph_node> (snode);
       if (node
 	  && lto_symtab_encoder_encode_body_p (encoder, node)
-	  && !node->symbol.alias
-	  && !node->thunk.thunk_p)
+	  && !node->symbol.alias)
 	{
 #ifdef ENABLE_CHECKING
 	  gcc_assert (!bitmap_bit_p (output, DECL_UID (node->symbol.decl)));
Index: lto-streamer-in.c
===================================================================
--- lto-streamer-in.c	(revision 202335)
+++ lto-streamer-in.c	(working copy)
@@ -998,6 +998,7 @@ input_function (tree fn_decl, struct dat
   free_dominance_info (CDI_DOMINATORS);
   free_dominance_info (CDI_POST_DOMINATORS);
   free (stmts);
+  pop_cfun ();
 }
 
 
@@ -1086,8 +1087,6 @@ lto_read_body (struct lto_file_decl_data
 
       /* Restore decl state */
       file_data->current_decl_state = file_data->global_decl_state;
-
-      pop_cfun ();
     }
 
   lto_data_in_delete (data_in);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-07  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-07  8:15 Fix gimple thunks Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).