diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3cf19511d2..3e4d5bed365 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-11-11 Jan Hubicka + + (patch by Richard Guenther) + * lto-streamer-out.c (output_function): Output head of argument list + earlier. + * lto-streamer-in.c (input_function): Re-map arguments into merged + declaration. + 2009-11-11 Jan Hubicka * lto-cgraph.c: Include gcov-io.h diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 7e1559cbdbe..59784a42f63 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1262,6 +1262,7 @@ input_function (tree fn_decl, struct data_in *data_in, basic_block bb; struct bitpack_d *bp; struct cgraph_node *node; + tree args, narg, oarg; fn = DECL_STRUCT_FUNCTION (fn_decl); tag = input_record_start (ib); @@ -1296,6 +1297,22 @@ input_function (tree fn_decl, struct data_in *data_in, /* Read all the local symbols. */ fn->local_decls = lto_input_tree (ib, data_in); + /* Read all function arguments. We need to re-map them here to the + arguments of the merged function declaration. */ + args = lto_input_tree (ib, data_in); + for (oarg = args, narg = DECL_ARGUMENTS (fn_decl); + oarg && narg; + oarg = TREE_CHAIN (oarg), narg = TREE_CHAIN (narg)) + { + int ix; + bool res; + res = lto_streamer_cache_lookup (data_in->reader_cache, oarg, &ix); + gcc_assert (res); + /* Replace the argument in the streamer cache. */ + lto_streamer_cache_insert_at (data_in->reader_cache, narg, ix); + } + gcc_assert (!oarg && !narg); + /* Read all the SSA names. */ input_ssa_names (ib, data_in, fn); @@ -1307,9 +1324,6 @@ input_function (tree fn_decl, struct data_in *data_in, gcc_assert (DECL_INITIAL (fn_decl)); DECL_SAVED_TREE (fn_decl) = NULL_TREE; - /* Read all function arguments. */ - DECL_ARGUMENTS (fn_decl) = lto_input_tree (ib, data_in); - /* Read all the basic blocks. */ tag = input_record_start (ib); while (tag) diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index fee23720c92..1c5f9103934 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1870,6 +1870,9 @@ output_function (struct cgraph_node *node) /* Output all the local variables in the function. */ lto_output_tree_ref (ob, fn->local_decls); + /* Output the head of the arguments list. */ + lto_output_tree_ref (ob, DECL_ARGUMENTS (function)); + /* Output all the SSA names used in the function. */ output_ssa_names (ob, fn); @@ -1880,9 +1883,6 @@ output_function (struct cgraph_node *node) lexical scopes. */ lto_output_tree (ob, DECL_INITIAL (function), true); - /* Output the head of the arguments list. */ - lto_output_tree_ref (ob, DECL_ARGUMENTS (function)); - /* We will renumber the statements. The code that does this uses the same ordering that we use for serializing them so we can use the same code on the other end and not have to write out the