diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2019-10-13 09:34:31 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-10-13 07:34:31 +0000 |
commit | af0d0f50722e17f9c7c23149866143e1c54d3ec3 (patch) | |
tree | c25f3df4caad1c14b49dd62315caeaf196f7cb83 | |
parent | cb6055a89f71bbd2d0858bb24ce2af473804e3a8 (diff) | |
download | gcc-af0d0f50722e17f9c7c23149866143e1c54d3ec3.zip gcc-af0d0f50722e17f9c7c23149866143e1c54d3ec3.tar.gz gcc-af0d0f50722e17f9c7c23149866143e1c54d3ec3.tar.bz2 |
lto-streamer-out.c (collect_block_tree_leafs): Renumber statements so non-virutal are before virutals.
* lto-streamer-out.c (collect_block_tree_leafs): Renumber statements
so non-virutal are before virutals.
(output_function): Avoid body modifications.
From-SVN: r276934
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 85 |
2 files changed, 49 insertions, 42 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3cd90c7..4df0e0d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-12 Jan Hubicka <hubicka@ucw.cz> + + * lto-streamer-out.c (collect_block_tree_leafs): Renumber statements + so non-virutal are before virutals. + (output_function): Avoid body modifications. + 2019-10-12 John David Anglin <danglin@gcc.gnu.org> * config/pa/pa.c (pa_output_call): Load descriptor address to register diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index c494c73..285c010a 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2066,14 +2066,54 @@ collect_block_tree_leafs (tree root, vec<tree> &leafs) void lto_prepare_function_for_streaming (struct cgraph_node *node) { - if (number_of_loops (DECL_STRUCT_FUNCTION (node->decl))) + struct function *fn = DECL_STRUCT_FUNCTION (node->decl); + basic_block bb; + + if (number_of_loops (fn)) { - push_cfun (DECL_STRUCT_FUNCTION (node->decl)); + push_cfun (fn); loop_optimizer_init (AVOID_CFG_MODIFICATIONS); loop_optimizer_finalize (); pop_cfun (); } - renumber_gimple_stmt_uids (DECL_STRUCT_FUNCTION (node->decl)); + /* 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 + statement numbers. We do not assign UIDs to PHIs here because + virtual PHIs get re-computed on-the-fly which would make numbers + inconsistent. */ + set_gimple_stmt_max_uid (fn, 0); + FOR_ALL_BB_FN (bb, fn) + { + for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) + { + gphi *stmt = gsi.phi (); + + /* Virtual PHIs are not going to be streamed. */ + if (!virtual_operand_p (gimple_phi_result (stmt))) + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); + } + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) + { + gimple *stmt = gsi_stmt (gsi); + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); + } + } + /* To avoid keeping duplicate gimple IDs in the statements, renumber + virtual phis now. */ + FOR_ALL_BB_FN (bb, fn) + { + for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) + { + gphi *stmt = gsi.phi (); + if (virtual_operand_p (gimple_phi_result (stmt))) + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); + } + } + } /* Output the body of function NODE->DECL. */ @@ -2144,45 +2184,6 @@ output_function (struct cgraph_node *node) /* Output any exception handling regions. */ output_eh_regions (ob, fn); - - /* 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 - statement numbers. We do not assign UIDs to PHIs here because - virtual PHIs get re-computed on-the-fly which would make numbers - inconsistent. */ - set_gimple_stmt_max_uid (fn, 0); - FOR_ALL_BB_FN (bb, fn) - { - for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gphi *stmt = gsi.phi (); - - /* Virtual PHIs are not going to be streamed. */ - if (!virtual_operand_p (gimple_phi_result (stmt))) - gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); - } - for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gimple *stmt = gsi_stmt (gsi); - gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); - } - } - /* To avoid keeping duplicate gimple IDs in the statements, renumber - virtual phis now. */ - FOR_ALL_BB_FN (bb, fn) - { - for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gphi *stmt = gsi.phi (); - if (virtual_operand_p (gimple_phi_result (stmt))) - gimple_set_uid (stmt, inc_gimple_stmt_max_uid (fn)); - } - } - /* Output the code for the function. */ FOR_ALL_BB_FN (bb, fn) output_bb (ob, bb, fn); |