diff options
author | Richard Guenther <rguenther@suse.de> | 2010-10-13 15:42:46 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-10-13 15:42:46 +0000 |
commit | 1b7d2dd1e0af14c86155013d8bab4bf44783bc05 (patch) | |
tree | 6ce95dedb669feed9d7cb577d50520074ea7d424 /gcc/cgraphunit.c | |
parent | 565d018dae66fe00c01577926eb3de8e0b37cc5a (diff) | |
download | gcc-1b7d2dd1e0af14c86155013d8bab4bf44783bc05.zip gcc-1b7d2dd1e0af14c86155013d8bab4bf44783bc05.tar.gz gcc-1b7d2dd1e0af14c86155013d8bab4bf44783bc05.tar.bz2 |
re PR tree-optimization/45788 (-fwhole-program causes ICE error: BB 3 can not throw but has an EH edge)
2010-10-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45788
* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Delay
EH update until fixup-cfg.
* g++.dg/pr45788.C: New testcase.
From-SVN: r165425
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 95f30e2..95b3007 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2156,6 +2156,7 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) if (e->callee->clone.combined_args_to_skip) { gimple_stmt_iterator gsi; + int lp_nr; new_stmt = gimple_call_copy_skip_args (e->call_stmt, @@ -2168,16 +2169,22 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) gsi = gsi_for_stmt (e->call_stmt); gsi_replace (&gsi, new_stmt, false); - if (maybe_clean_or_replace_eh_stmt (e->call_stmt, new_stmt)) - gimple_purge_dead_eh_edges (gimple_bb (new_stmt)); + /* We need to defer cleaning EH info on the new statement to + fixup-cfg. We may not have dominator information at this point + and thus would end up with unreachable blocks and have no way + to communicate that we need to run CFG cleanup then. */ + lp_nr = lookup_stmt_eh_lp (e->call_stmt); + if (lp_nr != 0) + { + remove_stmt_from_eh_lp (e->call_stmt); + add_stmt_to_eh_lp (new_stmt, lp_nr); + } } else { new_stmt = e->call_stmt; gimple_call_set_fndecl (new_stmt, e->callee->decl); update_stmt (new_stmt); - if (maybe_clean_eh_stmt (new_stmt)) - gimple_purge_dead_eh_edges (gimple_bb (new_stmt)); } cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt); |