Commit b5b3ec3e by Richard Guenther Committed by Richard Biener

gimple-iterator.c (gsi_remove): Return whether EH edges need to be cleanup.

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.

From-SVN: r186159
parent 4e48b6f1
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> 2012-04-04 Mike Stump <mikestump@comcast.net>
* doc/rtl.texi (const_double): Document as sign-extending. * doc/rtl.texi (const_double): Document as sign-extending.
......
...@@ -499,13 +499,15 @@ gsi_insert_after (gimple_stmt_iterator *i, gimple stmt, ...@@ -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 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 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 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) gsi_remove (gimple_stmt_iterator *i, bool remove_permanently)
{ {
gimple_seq_node cur, next, prev; gimple_seq_node cur, next, prev;
gimple stmt = gsi_stmt (*i); gimple stmt = gsi_stmt (*i);
bool require_eh_edge_purge = false;
if (gimple_code (stmt) != GIMPLE_PHI) if (gimple_code (stmt) != GIMPLE_PHI)
insert_debug_temps_for_defs (i); insert_debug_temps_for_defs (i);
...@@ -517,7 +519,7 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) ...@@ -517,7 +519,7 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently)
if (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); gimple_remove_stmt_histograms (cfun, stmt);
} }
...@@ -537,6 +539,8 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) ...@@ -537,6 +539,8 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently)
gimple_seq_set_last (i->seq, prev); gimple_seq_set_last (i->seq, prev);
i->ptr = next; i->ptr = next;
return require_eh_edge_purge;
} }
......
...@@ -5095,7 +5095,7 @@ void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq, ...@@ -5095,7 +5095,7 @@ void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
enum gsi_iterator_update); enum gsi_iterator_update);
void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq, void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
enum gsi_iterator_update); 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); gimple_stmt_iterator gsi_for_stmt (gimple);
void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *); void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *); void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
......
...@@ -2294,10 +2294,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si) ...@@ -2294,10 +2294,8 @@ optimize_stmt (basic_block bb, gimple_stmt_iterator si)
&& rhs == cached_lhs) && rhs == cached_lhs)
{ {
basic_block bb = gimple_bb (stmt); basic_block bb = gimple_bb (stmt);
int lp_nr = lookup_stmt_eh_lp (stmt);
unlink_stmt_vdef (stmt); unlink_stmt_vdef (stmt);
gsi_remove (&si, true); if (gsi_remove (&si, true))
if (lp_nr != 0)
{ {
bitmap_set_bit (need_eh_cleanup, bb->index); bitmap_set_bit (need_eh_cleanup, bb->index);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
......
...@@ -257,10 +257,9 @@ dse_optimize_stmt (gimple_stmt_iterator gsi) ...@@ -257,10 +257,9 @@ dse_optimize_stmt (gimple_stmt_iterator gsi)
/* Then we need to fix the operand of the consuming stmt. */ /* Then we need to fix the operand of the consuming stmt. */
unlink_stmt_vdef (stmt); unlink_stmt_vdef (stmt);
bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
/* Remove the dead store. */ /* 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 /* And release any SSA_NAMEs set in this statement back to the
SSA_NAME manager. */ SSA_NAME manager. */
......
...@@ -325,9 +325,9 @@ remove_prop_source_from_use (tree name) ...@@ -325,9 +325,9 @@ remove_prop_source_from_use (tree name)
bb = gimple_bb (stmt); bb = gimple_bb (stmt);
gsi = gsi_for_stmt (stmt); gsi = gsi_for_stmt (stmt);
unlink_stmt_vdef (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); release_defs (stmt);
cfg_changed |= gimple_purge_dead_eh_edges (bb);
name = is_gimple_assign (stmt) ? gimple_assign_rhs1 (stmt) : NULL_TREE; name = is_gimple_assign (stmt) ? gimple_assign_rhs1 (stmt) : NULL_TREE;
} while (name && TREE_CODE (name) == SSA_NAME); } while (name && TREE_CODE (name) == SSA_NAME);
......
...@@ -2658,10 +2658,10 @@ execute_optimize_widening_mul (void) ...@@ -2658,10 +2658,10 @@ execute_optimize_widening_mul (void)
gimple_call_arg (stmt, 0))) gimple_call_arg (stmt, 0)))
{ {
unlink_stmt_vdef (stmt); unlink_stmt_vdef (stmt);
gsi_remove (&gsi, true); if (gsi_remove (&gsi, true)
release_defs (stmt); && gimple_purge_dead_eh_edges (bb))
if (gimple_purge_dead_eh_edges (bb))
cfg_changed = true; cfg_changed = true;
release_defs (stmt);
continue; continue;
} }
break; break;
......
...@@ -1475,18 +1475,19 @@ unlink_stmt_vdef (gimple stmt) ...@@ -1475,18 +1475,19 @@ unlink_stmt_vdef (gimple stmt)
imm_use_iterator iter; imm_use_iterator iter;
gimple use_stmt; gimple use_stmt;
tree vdef = gimple_vdef (stmt); tree vdef = gimple_vdef (stmt);
tree vuse = gimple_vuse (stmt);
if (!vdef if (!vdef
|| TREE_CODE (vdef) != SSA_NAME) || TREE_CODE (vdef) != SSA_NAME)
return; 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) 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))) if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vdef))
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_vuse (stmt)) = 1; SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vuse) = 1;
} }
...@@ -4629,11 +4629,8 @@ eliminate (void) ...@@ -4629,11 +4629,8 @@ eliminate (void)
basic_block bb = gimple_bb (stmt); basic_block bb = gimple_bb (stmt);
gsi = gsi_for_stmt (stmt); gsi = gsi_for_stmt (stmt);
unlink_stmt_vdef (stmt); unlink_stmt_vdef (stmt);
gsi_remove (&gsi, true); if (gsi_remove (&gsi, true))
/* ??? gsi_remove doesn't tell us whether the stmt was bitmap_set_bit (need_eh_cleanup, bb->index);
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 (TREE_CODE (lhs) == SSA_NAME) if (TREE_CODE (lhs) == SSA_NAME)
bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs)); bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs));
release_defs (stmt); release_defs (stmt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment