diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-05 09:43:48 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-05 09:43:48 +0000 |
commit | 13ff78a491d6e5166f838c74bd377ad4d2ed81b6 (patch) | |
tree | 6258ff245914afce423859c9d6e66227cf605076 | |
parent | f5149f4c7812d65b5e5f1126d01cafe8ebef9d2b (diff) | |
download | gcc-13ff78a491d6e5166f838c74bd377ad4d2ed81b6.tar.gz |
2012-04-05 Richard Guenther <rguenther@suse.de>
* gimple-iterator.c (gsi_remove): Return whether EH edges need to be
cleanup.
* gimple.h (gsi_remove): Adjust.
* tree-ssa-operands.c (unlink_stmt_vdef): Optimize.
* tree-ssa-dom.c (optimize_stmt): Use gsi_remove result.
* tree-ssa-dse.c (dse_optimize_stmt): Likewise.
* tree-ssa-forwprop.c (remove_prop_source_from_use): Likewise.
* tree-ssa-math-opts.c (execute_optimize_widening_mul): Likewise.
* tree-ssa-pre.c (eliminate): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186159 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/gimple-iterator.c | 10 | ||||
-rw-r--r-- | gcc/gimple.h | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-dse.c | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 7 |
9 files changed, 35 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23c9435ba68..591c5af93ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2012-04-05 Richard Guenther <rguenther@suse.de> + + * gimple-iterator.c (gsi_remove): Return whether EH edges need to be + cleanup. + * gimple.h (gsi_remove): Adjust. + * tree-ssa-operands.c (unlink_stmt_vdef): Optimize. + * tree-ssa-dom.c (optimize_stmt): Use gsi_remove result. + * tree-ssa-dse.c (dse_optimize_stmt): Likewise. + * tree-ssa-forwprop.c (remove_prop_source_from_use): Likewise. + * tree-ssa-math-opts.c (execute_optimize_widening_mul): Likewise. + * tree-ssa-pre.c (eliminate): Likewise. + 2012-04-04 Mike Stump <mikestump@comcast.net> * doc/rtl.texi (const_double): Document as sign-extending. diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c index f5a1d26dc27..e387c16e31a 100644 --- a/gcc/gimple-iterator.c +++ b/gcc/gimple-iterator.c @@ -499,13 +499,15 @@ gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, REMOVE_PERMANENTLY is true when the statement is going to be removed from the IL and not reinserted elsewhere. In that case we remove the statement pointed to by iterator I from the EH tables, and free its - operand caches. Otherwise we do not modify this information. */ + operand caches. Otherwise we do not modify this information. Returns + true whether EH edge cleanup is required. */ -void +bool gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) { gimple_seq_node cur, next, prev; gimple stmt = gsi_stmt (*i); + bool require_eh_edge_purge = false; if (gimple_code (stmt) != GIMPLE_PHI) insert_debug_temps_for_defs (i); @@ -517,7 +519,7 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) if (remove_permanently) { - remove_stmt_from_eh_lp (stmt); + require_eh_edge_purge = remove_stmt_from_eh_lp (stmt); gimple_remove_stmt_histograms (cfun, stmt); } @@ -537,6 +539,8 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) gimple_seq_set_last (i->seq, prev); i->ptr = next; + + return require_eh_edge_purge; } diff --git a/gcc/gimple.h b/gcc/gimple.h index 167bc738a40..6af6dc48536 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -5095,7 +5095,7 @@ void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq, enum gsi_iterator_update); void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq, enum gsi_iterator_update); -void gsi_remove (gimple_stmt_iterator *, bool); +bool gsi_remove (gimple_stmt_iterator *, bool); gimple_stmt_iterator gsi_for_stmt (gimple); void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *); void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 4ea9644dd27..d2e4cc4b0b3 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2294,10 +2294,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si) && rhs == cached_lhs) { basic_block bb = gimple_bb (stmt); - int lp_nr = lookup_stmt_eh_lp (stmt); unlink_stmt_vdef (stmt); - gsi_remove (&si, true); - if (lp_nr != 0) + if (gsi_remove (&si, true)) { bitmap_set_bit (need_eh_cleanup, bb->index); if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 285d08c66c6..93ba42506d7 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -257,10 +257,9 @@ dse_optimize_stmt (gimple_stmt_iterator gsi) /* 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); + if (gsi_remove (&gsi, true)) + bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); /* And release any SSA_NAMEs set in this statement back to the SSA_NAME manager. */ diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 2b16222bbd5..c99af1a8c43 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -325,9 +325,9 @@ remove_prop_source_from_use (tree name) bb = gimple_bb (stmt); gsi = gsi_for_stmt (stmt); unlink_stmt_vdef (stmt); - gsi_remove (&gsi, true); + if (gsi_remove (&gsi, true)) + cfg_changed |= gimple_purge_dead_eh_edges (bb); release_defs (stmt); - cfg_changed |= gimple_purge_dead_eh_edges (bb); name = is_gimple_assign (stmt) ? gimple_assign_rhs1 (stmt) : NULL_TREE; } while (name && TREE_CODE (name) == SSA_NAME); diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index ab982f50482..5c3543ecf39 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2658,10 +2658,10 @@ execute_optimize_widening_mul (void) gimple_call_arg (stmt, 0))) { unlink_stmt_vdef (stmt); - gsi_remove (&gsi, true); - release_defs (stmt); - if (gimple_purge_dead_eh_edges (bb)) + if (gsi_remove (&gsi, true) + && gimple_purge_dead_eh_edges (bb)) cfg_changed = true; + release_defs (stmt); continue; } break; diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index ed0d34de2df..2994a1211bc 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1475,18 +1475,19 @@ unlink_stmt_vdef (gimple stmt) imm_use_iterator iter; gimple use_stmt; tree vdef = gimple_vdef (stmt); + tree vuse = gimple_vuse (stmt); if (!vdef || TREE_CODE (vdef) != SSA_NAME) return; - FOR_EACH_IMM_USE_STMT (use_stmt, iter, gimple_vdef (stmt)) + FOR_EACH_IMM_USE_STMT (use_stmt, iter, vdef) { FOR_EACH_IMM_USE_ON_STMT (use_p, iter) - SET_USE (use_p, gimple_vuse (stmt)); + SET_USE (use_p, vuse); } - if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_vdef (stmt))) - SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_vuse (stmt)) = 1; + if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vdef)) + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vuse) = 1; } diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 6a2ce643d74..5e6f5708ad1 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4629,11 +4629,8 @@ eliminate (void) basic_block bb = gimple_bb (stmt); gsi = gsi_for_stmt (stmt); unlink_stmt_vdef (stmt); - gsi_remove (&gsi, true); - /* ??? gsi_remove doesn't tell us whether the stmt was - in EH tables and thus whether we need to purge EH edges. - Simply schedule the block for a cleanup. */ - bitmap_set_bit (need_eh_cleanup, bb->index); + if (gsi_remove (&gsi, true)) + bitmap_set_bit (need_eh_cleanup, bb->index); if (TREE_CODE (lhs) == SSA_NAME) bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs)); release_defs (stmt); |