aboutsummaryrefslogtreecommitdiff
path: root/gcc/passes.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-10-11 10:59:16 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2019-10-11 08:59:16 +0000
commit1fcf52a6a2208a57e4542e1b830a7ac5cfa216a2 (patch)
treeef9cac22b1e7b08c43bf2ff06a8714ed61dbcc77 /gcc/passes.c
parent05626b02e8d02720771d361677b1d6cc38df9ddc (diff)
downloadgcc-1fcf52a6a2208a57e4542e1b830a7ac5cfa216a2.zip
gcc-1fcf52a6a2208a57e4542e1b830a7ac5cfa216a2.tar.gz
gcc-1fcf52a6a2208a57e4542e1b830a7ac5cfa216a2.tar.bz2
Do not allocate ggc during streaming.
* gimple-streamer-out.c (output_gimple_stmt): Add explicit function parameter. * lto-streamer-out.c: Include tree-dfa.h. (output_cfg): Do not use cfun. (lto_prepare_function_for_streaming): New. (output_function): Do not push cfun; do not initialize loop optimizer. * lto-streamer.h (lto_prepare_function_for_streaming): Declare. * passes.c (ipa_write_summaries): Use it. (ipa_write_optimization_summaries): Do not modify bodies. * tree-dfa.c (renumber_gimple_stmt_uids): Add function parameter. * tree.dfa.h (renumber_gimple_stmt_uids): Update prototype. * tree-ssa-dse.c (pass_dse::execute): Update use of renumber_gimple_stmt_uids. * tree-ssa-math-opts.c (pass_optimize_widening_mul::execute): Likewise. * lto.c (lto_wpa_write_files): Prepare all bodies for streaming. From-SVN: r276870
Diffstat (limited to 'gcc/passes.c')
-rw-r--r--gcc/passes.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/gcc/passes.c b/gcc/passes.c
index f715c67..863605d 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -2705,20 +2705,12 @@ ipa_write_summaries (void)
{
struct cgraph_node *node = order[i];
- if (gimple_has_body_p (node->decl))
+ if (node->definition && node->need_lto_streaming)
{
- /* When streaming out references to statements as part of some IPA
- pass summary, the statements need to have uids assigned and the
- following does that for all the IPA passes here. Naturally, this
- ordering then matches the one IPA-passes get in their stmt_fixup
- hooks. */
-
- push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- renumber_gimple_stmt_uids ();
- pop_cfun ();
+ if (gimple_has_body_p (node->decl))
+ lto_prepare_function_for_streaming (node);
+ lto_set_symtab_encoder_in_partition (encoder, node);
}
- if (node->definition && node->need_lto_streaming)
- lto_set_symtab_encoder_in_partition (encoder, node);
}
FOR_EACH_DEFINED_FUNCTION (node)
@@ -2786,28 +2778,13 @@ void
ipa_write_optimization_summaries (lto_symtab_encoder_t encoder)
{
struct lto_out_decl_state *state = lto_new_out_decl_state ();
- lto_symtab_encoder_iterator lsei;
state->symtab_node_encoder = encoder;
lto_output_init_mode_table ();
lto_push_out_decl_state (state);
- for (lsei = lsei_start_function_in_partition (encoder);
- !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei))
- {
- struct cgraph_node *node = lsei_cgraph_node (lsei);
- /* When streaming out references to statements as part of some IPA
- pass summary, the statements need to have uids assigned.
-
- For functions newly born at WPA stage we need to initialize
- the uids here. */
- if (node->definition
- && gimple_has_body_p (node->decl))
- {
- push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- renumber_gimple_stmt_uids ();
- pop_cfun ();
- }
- }
+
+ /* Be sure that we did not forget to renumber stmt uids. */
+ gcc_checking_assert (flag_wpa);
gcc_assert (flag_wpa);
pass_manager *passes = g->get_passes ();