aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-01-21 21:09:44 -0700
committerJeff Law <law@gcc.gnu.org>2011-01-21 21:09:44 -0700
commitcaaf13d38729701accab60cfee5d743a5b9afad1 (patch)
treee26bd30b7702ab14267fea3bce44ce25dab21466 /gcc/tree-ssa-dse.c
parent47ba04ab544664fefe22f0e49e2307647bc33af5 (diff)
downloadgcc-caaf13d38729701accab60cfee5d743a5b9afad1.zip
gcc-caaf13d38729701accab60cfee5d743a5b9afad1.tar.gz
gcc-caaf13d38729701accab60cfee5d743a5b9afad1.tar.bz2
re PR tree-optimization/47053 (ICE: verify_flow_info failed: BB 2 can not throw but has an EH edge with -O -fnon-call-exceptions)
PR tree-optimization/47053 * tree-ssa-dse.c (need_eh_cleanup): New bitmap. (dse_optimize_stmt): Set the appropriate bit in NEED_EH_CLEANUP when statements are deleted. (tree_ssa_dse): Allocate & free NEED_EH_CLEANUP. If NEED_EH_CLEANUP is nonempty, then purge dead edges and cleanup the CFG. PR tree-optimization/47053 * g++.dg/pr47053.C: New test. From-SVN: r169123
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 80c2622..26a438d 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -83,6 +83,10 @@ struct dse_block_local_data
bitmap stores;
};
+/* Bitmap of blocks that have had EH statements cleaned. We should
+ remove their dead edges eventually. */
+static bitmap need_eh_cleanup;
+
static bool gate_dse (void);
static unsigned int tree_ssa_dse (void);
static void dse_initialize_block_local_data (struct dom_walk_data *,
@@ -335,6 +339,8 @@ dse_optimize_stmt (struct dse_global_data *dse_gd,
/* Then we need to fix the operand of the consuming stmt. */
unlink_stmt_vdef (stmt);
+ bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
+
/* Remove the dead store. */
gsi_remove (&gsi, true);
@@ -401,6 +407,8 @@ tree_ssa_dse (void)
struct dom_walk_data walk_data;
struct dse_global_data dse_gd;
+ need_eh_cleanup = BITMAP_ALLOC (NULL);
+
renumber_gimple_stmt_uids ();
/* We might consider making this a property of each pass so that it
@@ -435,6 +443,16 @@ tree_ssa_dse (void)
/* Release the main bitmap. */
BITMAP_FREE (dse_gd.stores);
+ /* Removal of stores may make some EH edges dead. Purge such edges from
+ the CFG as needed. */
+ if (!bitmap_empty_p (need_eh_cleanup))
+ {
+ gimple_purge_all_dead_eh_edges (need_eh_cleanup);
+ cleanup_tree_cfg ();
+ }
+
+ BITMAP_FREE (need_eh_cleanup);
+
/* For now, just wipe the post-dominator information. */
free_dominance_info (CDI_POST_DOMINATORS);
return 0;