+2020-01-10 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/93199
+ * tree-eh.c (redirect_eh_edge_1): Avoid some work if possible.
+ (cleanup_all_empty_eh): Walk landing pads in reverse order to
+ avoid quadraticness.
+
2020-01-10 Martin Jambor <mjambor@suse.cz>
* params.opt (param_ipa_sra_max_replacements): Mark as Optimization.
old_lp = get_eh_landing_pad_from_number (old_lp_nr);
throw_stmt = last_stmt (edge_in->src);
- gcc_assert (lookup_stmt_eh_lp (throw_stmt) == old_lp_nr);
+ gcc_checking_assert (lookup_stmt_eh_lp (throw_stmt) == old_lp_nr);
new_label = gimple_block_label (new_bb);
| | EH
<..>
which CFG verification would choke on. See PR45172 and PR51089. */
- FOR_EACH_EDGE (e, ei, old_bb->preds)
- if (find_edge (e->src, new_bb))
- return false;
+ if (!single_pred_p (new_bb))
+ FOR_EACH_EDGE (e, ei, old_bb->preds)
+ if (find_edge (e->src, new_bb))
+ return false;
FOR_EACH_EDGE (e, ei, old_bb->preds)
redirect_edge_var_map_clear (e);
eh_landing_pad lp;
int i;
- for (i = 1; vec_safe_iterate (cfun->eh->lp_array, i, &lp); ++i)
- if (lp)
- changed |= cleanup_empty_eh (lp);
+ /* Ideally we'd walk the region tree and process LPs inner to outer
+ to avoid quadraticness in EH redirection. Walking the LP array
+ in reverse seems to be an approximation of that. */
+ for (i = vec_safe_length (cfun->eh->lp_array) - 1; i >= 1; --i)
+ {
+ lp = (*cfun->eh->lp_array)[i];
+ if (lp)
+ changed |= cleanup_empty_eh (lp);
+ }
return changed;
}