diff options
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 44 |
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 (); |