From: Richard Biener Date: Mon, 4 Jun 2018 11:38:38 +0000 (+0000) Subject: tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ccaa21f0cdab09acd959883dd4d5a68692807dd;p=gcc.git tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into... 2018-06-04 Richard Biener * tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into... (cleanup_tree_cfg_noloop): ... single caller. Do start_recording_case_labels later. From-SVN: r261145 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03fe3e01ca4..83a7a4f9d90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-04 Richard Biener + + * tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into... + (cleanup_tree_cfg_noloop): ... single caller. Do + start_recording_case_labels later. + 2018-06-04 Sebastian Peryt * config/i386/cldemoteintrin.h: Change define from _X86INTRIN_H_INCLUDED diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 1bf7771dac1..55fce08ad96 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -757,66 +757,6 @@ cleanup_control_flow_pre () return retval; } -/* Iterate the cfg cleanups, while anything changes. */ - -static bool -cleanup_tree_cfg_1 (void) -{ - bool retval = false; - basic_block bb; - unsigned i, n; - - /* Prepare the worklists of altered blocks. */ - cfgcleanup_altered_bbs = BITMAP_ALLOC (NULL); - - /* During forwarder block cleanup, we may redirect edges out of - SWITCH_EXPRs, which can get expensive. So we want to enable - recording of edge to CASE_LABEL_EXPR. */ - start_recording_case_labels (); - - /* We cannot use FOR_EACH_BB_FN for the BB iterations below - since the basic blocks may get removed. */ - - /* Start by iterating over all basic blocks in PRE order looking for - edge removal opportunities. Do this first because incoming SSA form - may be invalid and we want to avoid performing SSA related tasks such - as propgating out a PHI node during BB merging in that state. */ - retval |= cleanup_control_flow_pre (); - - /* After doing the above SSA form should be valid (or an update SSA - should be required). */ - - /* Continue by iterating over all basic blocks looking for BB merging - opportunities. */ - n = last_basic_block_for_fn (cfun); - for (i = NUM_FIXED_BLOCKS; i < n; i++) - { - bb = BASIC_BLOCK_FOR_FN (cfun, i); - if (bb) - retval |= cleanup_tree_cfg_bb (bb); - } - - /* Now process the altered blocks, as long as any are available. */ - while (!bitmap_empty_p (cfgcleanup_altered_bbs)) - { - i = bitmap_first_set_bit (cfgcleanup_altered_bbs); - bitmap_clear_bit (cfgcleanup_altered_bbs, i); - if (i < NUM_FIXED_BLOCKS) - continue; - - bb = BASIC_BLOCK_FOR_FN (cfun, i); - if (!bb) - continue; - - retval |= cleanup_control_flow_bb (bb); - retval |= cleanup_tree_cfg_bb (bb); - } - - end_recording_case_labels (); - BITMAP_FREE (cfgcleanup_altered_bbs); - return retval; -} - static bool mfb_keep_latches (edge e) { @@ -833,10 +773,7 @@ cleanup_tree_cfg_noloop (void) timevar_push (TV_TREE_CLEANUP_CFG); - /* Iterate until there are no more cleanups left to do. If any - iteration changed the flowgraph, set CHANGED to true. - - If dominance information is available, there cannot be any unreachable + /* If dominance information is available, there cannot be any unreachable blocks. */ if (!dom_info_available_p (CDI_DOMINATORS)) { @@ -907,7 +844,52 @@ cleanup_tree_cfg_noloop (void) } } - changed |= cleanup_tree_cfg_1 (); + /* Prepare the worklists of altered blocks. */ + cfgcleanup_altered_bbs = BITMAP_ALLOC (NULL); + + /* Start by iterating over all basic blocks in PRE order looking for + edge removal opportunities. Do this first because incoming SSA form + may be invalid and we want to avoid performing SSA related tasks such + as propgating out a PHI node during BB merging in that state. */ + changed |= cleanup_control_flow_pre (); + + /* After doing the above SSA form should be valid (or an update SSA + should be required). */ + + /* During forwarder block cleanup, we may redirect edges out of + SWITCH_EXPRs, which can get expensive. So we want to enable + recording of edge to CASE_LABEL_EXPR. */ + start_recording_case_labels (); + + /* Continue by iterating over all basic blocks looking for BB merging + opportunities. We cannot use FOR_EACH_BB_FN for the BB iteration + since the basic blocks may get removed. */ + unsigned n = last_basic_block_for_fn (cfun); + for (unsigned i = NUM_FIXED_BLOCKS; i < n; i++) + { + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i); + if (bb) + changed |= cleanup_tree_cfg_bb (bb); + } + + /* Now process the altered blocks, as long as any are available. */ + while (!bitmap_empty_p (cfgcleanup_altered_bbs)) + { + unsigned i = bitmap_first_set_bit (cfgcleanup_altered_bbs); + bitmap_clear_bit (cfgcleanup_altered_bbs, i); + if (i < NUM_FIXED_BLOCKS) + continue; + + basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i); + if (!bb) + continue; + + changed |= cleanup_control_flow_bb (bb); + changed |= cleanup_tree_cfg_bb (bb); + } + + end_recording_case_labels (); + BITMAP_FREE (cfgcleanup_altered_bbs); gcc_assert (dom_info_available_p (CDI_DOMINATORS));