Commit 1ccaa21f by Richard Biener Committed by Richard Biener

tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into...

2018-06-04  Richard Biener  <rguenther@suse.de>

	* tree-cfgcleanup.c (cleanup_tree_cfg_1): Fold into...
	(cleanup_tree_cfg_noloop): ... single caller.  Do
	start_recording_case_labels later.

From-SVN: r261145
parent 5a6e3d79
2018-06-04 Richard Biener <rguenther@suse.de>
* 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 <sebastian.peryt@intel.com> 2018-06-04 Sebastian Peryt <sebastian.peryt@intel.com>
* config/i386/cldemoteintrin.h: Change define from _X86INTRIN_H_INCLUDED * config/i386/cldemoteintrin.h: Change define from _X86INTRIN_H_INCLUDED
......
...@@ -757,66 +757,6 @@ cleanup_control_flow_pre () ...@@ -757,66 +757,6 @@ cleanup_control_flow_pre ()
return retval; 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 static bool
mfb_keep_latches (edge e) mfb_keep_latches (edge e)
{ {
...@@ -833,10 +773,7 @@ cleanup_tree_cfg_noloop (void) ...@@ -833,10 +773,7 @@ cleanup_tree_cfg_noloop (void)
timevar_push (TV_TREE_CLEANUP_CFG); timevar_push (TV_TREE_CLEANUP_CFG);
/* Iterate until there are no more cleanups left to do. If any /* If dominance information is available, there cannot be any unreachable
iteration changed the flowgraph, set CHANGED to true.
If dominance information is available, there cannot be any unreachable
blocks. */ blocks. */
if (!dom_info_available_p (CDI_DOMINATORS)) if (!dom_info_available_p (CDI_DOMINATORS))
{ {
...@@ -907,7 +844,52 @@ cleanup_tree_cfg_noloop (void) ...@@ -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)); gcc_assert (dom_info_available_p (CDI_DOMINATORS));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment