tree-eh.c (make_eh_edges): Set probability 100% to first edge out of RESX.

* 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.

From-SVN: r145322
This commit is contained in:
Jan Hubicka 2009-03-31 00:35:22 +02:00 committed by Jan Hubicka
parent 7db6438d78
commit a203a2215b
2 changed files with 26 additions and 19 deletions

View file

@ -1,3 +1,9 @@
2009-03-30 Jan Hubicka <jh@suse.cz>
* 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.
2009-03-30 Vladimir Makarov <vmakarov@redhat.com>
* ira-int.h (ira_allocno): Rename left_conflicts_num to

View file

@ -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);