diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-30 22:35:22 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-30 22:35:22 +0000 |
commit | d6d5ab2d7cc0a06c9e623d37949b98d1ce332ce2 (patch) | |
tree | 7ca8a4ba57aa58c8e75cd7662adaef1ed69d0a64 /gcc/tree-eh.c | |
parent | 0ec8958e5aa24df116bdc5aa275194e9cfcd20cc (diff) | |
download | gcc-d6d5ab2d7cc0a06c9e623d37949b98d1ce332ce2.tar.gz |
* tree-eh.c (make_eh_edges): Set probability 100% to first edge out of RESX.
(tree_remove_unreachable_handlers): Cleanup EH predecestor detection and label
handling.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145322 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r-- | gcc/tree-eh.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 20e62edbf05..f55a4172b10 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -1974,6 +1974,7 @@ make_eh_edges (gimple stmt) int region_nr; bool is_resx; bool inlinable = false; + basic_block bb; if (gimple_code (stmt) == GIMPLE_RESX) { @@ -1990,6 +1991,13 @@ make_eh_edges (gimple stmt) } foreach_reachable_handler (region_nr, is_resx, inlinable, make_eh_edge, stmt); + + /* Make CFG profile more consistent assuming that exception will resume to first + available EH handler. In practice this makes little difference, but we get + fewer consistency errors in the dumps. */ + bb = gimple_bb (stmt); + if (is_resx && EDGE_COUNT (bb->succs)) + EDGE_SUCC (bb, 0)->probability = REG_BR_PROB_BASE; } static bool mark_eh_edge_found_error; @@ -2659,12 +2667,7 @@ tree_remove_unreachable_handlers (void) { gimple_stmt_iterator gsi; int region; - bool has_eh_preds = false; - edge e; - edge_iterator ei; - - FOR_EACH_EDGE (e, ei, bb->preds) if (e->flags & EDGE_EH) - has_eh_preds = true; + bool has_eh_preds = bb_has_eh_pred (bb); for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { @@ -2673,11 +2676,8 @@ tree_remove_unreachable_handlers (void) if (gimple_code (stmt) == GIMPLE_LABEL && has_eh_preds) { int uid = LABEL_DECL_UID (gimple_label_label (stmt)); - if (uid <= cfun->cfg->last_label_uid) - { - int region = VEC_index (int, label_to_region, uid); - SET_BIT (reachable, region); - } + int region = VEC_index (int, label_to_region, uid); + SET_BIT (reachable, region); } if (gimple_code (stmt) == RESX) SET_BIT (reachable, gimple_resx_region (stmt)); @@ -2824,14 +2824,15 @@ cleanup_empty_eh (basic_block bb) if (!stmt_can_throw_internal (last_stmt (src))) continue; make_eh_edges (last_stmt (src)); - FOR_EACH_EDGE (e, ei, src->succs) if (e->flags & EDGE_EH) - { - dominance_info_invalidated = true; - for (si = gsi_start_phis (e->dest); !gsi_end_p (si); - gsi_next (&si)) - mark_sym_for_renaming (SSA_NAME_VAR - (PHI_RESULT (gsi_stmt (si)))); - } + FOR_EACH_EDGE (e, ei, src->succs) + if (e->flags & EDGE_EH) + { + dominance_info_invalidated = true; + for (si = gsi_start_phis (e->dest); !gsi_end_p (si); + gsi_next (&si)) + mark_sym_for_renaming (SSA_NAME_VAR + (PHI_RESULT (gsi_stmt (si)))); + } } if (dump_file) fprintf (dump_file, "Empty EH handler %i removed\n", region); |