summaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-13 08:47:14 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-13 08:47:14 +0000
commit25959a395efef4c26d979720c98df9a2737a5f1b (patch)
treeb652e843afc3a6d9186d29d95bbeae5f778cee40 /gcc/tree-cfgcleanup.c
parentc6e5fbebbeb48cd9040b57fb4e4764c252a73ea1 (diff)
downloadgcc-25959a395efef4c26d979720c98df9a2737a5f1b.tar.gz
2015-03-10 Richard Biener <rguenther@suse.de>
PR middle-end/44563 * tree-cfgcleanup.c (split_bb_on_noreturn_calls): Remove. (cleanup_tree_cfg_1): Do not call it. (execute_cleanup_cfg_post_optimizing): Fixup the CFG here. (fixup_noreturn_call): Mark the stmt as control altering. * tree-cfg.c (execute_fixup_cfg): Do not dump the function here. (pass_data_fixup_cfg): Produce a dump file. * tree-ssa-dom.c: Include tree-cfgcleanup.h. (need_noreturn_fixup): New global. (pass_dominator::execute): Fixup queued noreturn calls. (optimize_stmt): Queue calls that became noreturn for fixup. * tree-ssa-forwprop.c (pass_forwprop::execute): Likewise. * tree-ssa-pre.c: Include tree-cfgcleanup.h. (el_to_fixup): New global. (eliminate_dom_walker::before_dom_childre): Queue calls that became noreturn for fixup. (eliminate): Fixup queued noreturn calls. * tree-ssa-propagate.c: Include tree-cfgcleanup.h. (substitute_and_fold_dom_walker): New member stmts_to_fixup. (substitute_and_fold_dom_walker::before_dom_children): Queue alls that became noreturn for fixup. (substitute_and_fold): Fixup queued noreturn calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 5c5c7bace75..f5a21a30f85 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -625,35 +625,13 @@ fixup_noreturn_call (gimple stmt)
update_stmt (stmt);
}
+ /* Mark the call as altering control flow. */
+ gimple_call_set_ctrl_altering (stmt, true);
+
return remove_fallthru_edge (bb->succs);
}
-/* Split basic blocks on calls in the middle of a basic block that are now
- known not to return, and remove the unreachable code. */
-
-static bool
-split_bb_on_noreturn_calls (basic_block bb)
-{
- bool changed = false;
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
-
- if (!is_gimple_call (stmt))
- continue;
-
- if (gimple_call_noreturn_p (stmt))
- changed |= fixup_noreturn_call (stmt);
- }
-
- if (changed)
- bitmap_set_bit (cfgcleanup_altered_bbs, bb->index);
- return changed;
-}
-
/* Tries to cleanup cfg in basic block BB. Returns true if anything
changes. */
@@ -703,10 +681,7 @@ cleanup_tree_cfg_1 (void)
{
bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (bb)
- {
- retval |= cleanup_tree_cfg_bb (bb);
- retval |= split_bb_on_noreturn_calls (bb);
- }
+ retval |= cleanup_tree_cfg_bb (bb);
}
/* Now process the altered blocks, as long as any are available. */
@@ -722,10 +697,6 @@ cleanup_tree_cfg_1 (void)
continue;
retval |= cleanup_tree_cfg_bb (bb);
-
- /* Rerun split_bb_on_noreturn_calls, in case we have altered any noreturn
- calls. */
- retval |= split_bb_on_noreturn_calls (bb);
}
end_recording_case_labels ();
@@ -1111,9 +1082,12 @@ make_pass_merge_phi (gcc::context *ctxt)
static unsigned int
execute_cleanup_cfg_post_optimizing (void)
{
- unsigned int todo = 0;
+ unsigned int todo = execute_fixup_cfg ();
if (cleanup_tree_cfg ())
- todo |= TODO_update_ssa;
+ {
+ todo &= ~TODO_cleanup_cfg;
+ todo |= TODO_update_ssa;
+ }
maybe_remove_unreachable_handlers ();
cleanup_dead_labels ();
group_case_labels ();