aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-01-10 10:49:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2020-01-10 10:49:57 +0000
commit5eaf0c498f718f60591b06fa81fc51ace6a16c01 (patch)
treee8c7369bcad37986d524dbb8961de5ffcc7117a5
parent1a315435dbebed25a316906caf9fa80f4214a5dc (diff)
downloadgcc-5eaf0c498f718f60591b06fa81fc51ace6a16c01.zip
gcc-5eaf0c498f718f60591b06fa81fc51ace6a16c01.tar.gz
gcc-5eaf0c498f718f60591b06fa81fc51ace6a16c01.tar.bz2
re PR tree-optimization/93199 (Compile time hog in sink_clobbers)
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. From-SVN: r280101
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-eh.c21
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 61e3ef5..8b3b780 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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.
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index f25d2de8..408ff48 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2310,7 +2310,7 @@ redirect_eh_edge_1 (edge edge_in, basic_block new_bb, bool change_region)
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);
@@ -4307,9 +4307,10 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_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);
@@ -4698,9 +4699,15 @@ cleanup_all_empty_eh (void)
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;
}