int region_nr;
bool is_resx;
bool inlinable = false;
+ basic_block bb;
if (gimple_code (stmt) == GIMPLE_RESX)
{
}
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;
{
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))
{
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));
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);