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
This commit is contained in:
Richard Guenther 2012-04-05 09:43:48 +00:00 committed by Richard Biener
parent 4e48b6f14d
commit b5b3ec3e6e
9 changed files with 35 additions and 24 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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 *);

View File

@ -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))

View File

@ -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. */

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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);