Commit ae25dbda by Paolo Bonzini Committed by Paolo Bonzini

re PR tree-optimization/26830 (Repeated SSA update during loop header copying)

2006-03-30  Paolo Bonzini  <bonzini@gnu.org>

	PR tree-optimization/26830

	* tree-ssa-copy.c (copy_prop_visit_assignment): Do not check loop depth.
	(copy_prop_visit_stmt): Remove write-only variable ann.
	(init_copy_prop): Check variable loop depth here.  Do not simulate
	memory-tag and virtual operand PHIs except for store copy prop.

From-SVN: r112534
parent 7d3a3b01
2006-03-30 Paolo Bonzini <bonzini@gnu.org>
PR tree-optimization/26830
* tree-ssa-copy.c (copy_prop_visit_assignment): Do not check loop depth.
(copy_prop_visit_stmt): Remove write-only variable ann.
(init_copy_prop): Check variable loop depth here. Do not simulate
memory-tag and virtual operand PHIs except for store copy prop.
2006-03-30 Richard Guenther <rguenther@suse.de> 2006-03-30 Richard Guenther <rguenther@suse.de>
* config/i386/i386.c: Remove builtins for SSE2 ABI intrinsic * config/i386/i386.c: Remove builtins for SSE2 ABI intrinsic
......
...@@ -550,14 +550,6 @@ copy_prop_visit_assignment (tree stmt, tree *result_p) ...@@ -550,14 +550,6 @@ copy_prop_visit_assignment (tree stmt, tree *result_p)
if (!may_propagate_copy (lhs, rhs)) if (!may_propagate_copy (lhs, rhs))
return SSA_PROP_VARYING; return SSA_PROP_VARYING;
/* Avoid copy propagation from an inner into an outer loop.
Otherwise, this may move loop variant variables outside of
their loops and prevent coalescing opportunities. If the
value was loop invariant, it will be hoisted by LICM and
exposed for copy propagation. */
if (loop_depth_of_name (rhs) > loop_depth_of_name (lhs))
return SSA_PROP_VARYING;
/* Notice that in the case of assignments, we make the LHS be a /* Notice that in the case of assignments, we make the LHS be a
copy of RHS's value, not of RHS itself. This avoids keeping copy of RHS's value, not of RHS itself. This avoids keeping
unnecessary copy-of chains (assignments cannot be in a cycle unnecessary copy-of chains (assignments cannot be in a cycle
...@@ -671,7 +663,6 @@ copy_prop_visit_cond_stmt (tree stmt, edge *taken_edge_p) ...@@ -671,7 +663,6 @@ copy_prop_visit_cond_stmt (tree stmt, edge *taken_edge_p)
static enum ssa_prop_result static enum ssa_prop_result
copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p) copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p)
{ {
stmt_ann_t ann;
enum ssa_prop_result retval; enum ssa_prop_result retval;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
...@@ -681,8 +672,6 @@ copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p) ...@@ -681,8 +672,6 @@ copy_prop_visit_stmt (tree stmt, edge *taken_edge_p, tree *result_p)
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
ann = stmt_ann (stmt);
if (TREE_CODE (stmt) == MODIFY_EXPR if (TREE_CODE (stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (stmt, 1)) == SSA_NAME && TREE_CODE (TREE_OPERAND (stmt, 1)) == SSA_NAME
&& (do_store_copy_prop && (do_store_copy_prop
...@@ -856,37 +845,54 @@ init_copy_prop (void) ...@@ -856,37 +845,54 @@ init_copy_prop (void)
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
block_stmt_iterator si; block_stmt_iterator si;
tree phi; tree phi, def;
int depth = bb->loop_depth;
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{ {
tree stmt = bsi_stmt (si); tree stmt = bsi_stmt (si);
ssa_op_iter iter;
/* The only statements that we care about are those that may /* The only statements that we care about are those that may
generate useful copies. We also need to mark conditional generate useful copies. We also need to mark conditional
jumps so that their outgoing edges are added to the work jumps so that their outgoing edges are added to the work
lists of the propagator. */ lists of the propagator.
Avoid copy propagation from an inner into an outer loop.
Otherwise, this may move loop variant variables outside of
their loops and prevent coalescing opportunities. If the
value was loop invariant, it will be hoisted by LICM and
exposed for copy propagation. */
if (stmt_ends_bb_p (stmt)) if (stmt_ends_bb_p (stmt))
DONT_SIMULATE_AGAIN (stmt) = false; DONT_SIMULATE_AGAIN (stmt) = false;
else if (stmt_may_generate_copy (stmt)) else if (stmt_may_generate_copy (stmt)
&& loop_depth_of_name (TREE_OPERAND (stmt, 1)) <= depth)
DONT_SIMULATE_AGAIN (stmt) = false; DONT_SIMULATE_AGAIN (stmt) = false;
else else
{ DONT_SIMULATE_AGAIN (stmt) = true;
tree def;
ssa_op_iter iter; /* Mark all the outputs of this statement as not being
the copy of anything. */
/* No need to simulate this statement anymore. */ FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
DONT_SIMULATE_AGAIN (stmt) = true; if (DONT_SIMULATE_AGAIN (stmt))
set_copy_of_val (def, def, NULL_TREE);
/* Mark all the outputs of this statement as not being else
the copy of anything. */ cached_last_copy_of[SSA_NAME_VERSION (def)] = def;
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
set_copy_of_val (def, def, NULL_TREE);
}
} }
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
DONT_SIMULATE_AGAIN (phi) = false; {
def = PHI_RESULT (phi);
if (!do_store_copy_prop && !is_gimple_reg (def))
DONT_SIMULATE_AGAIN (phi) = true;
else
DONT_SIMULATE_AGAIN (phi) = false;
if (DONT_SIMULATE_AGAIN (phi))
set_copy_of_val (def, def, NULL_TREE);
else
cached_last_copy_of[SSA_NAME_VERSION (def)] = def;
}
} }
} }
......
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