Commit facbf948 by Jan Hubicka Committed by Jan Hubicka

tree-ssa-copyrename.c (copy_rename_partition_coalesce): Return true when something was changed.

	* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Return
	true when something was changed.
	(rename_ssa_copies): When something was changed, do
	TODO_remove_unused_locals.
	* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value):
	add TODO_remove_unused_locals when instruction was removed.

From-SVN: r121571
parent 22ad64b6
2007-02-04 Jan Hubicka <jh@suse.cz> 2007-02-04 Jan Hubicka <jh@suse.cz>
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Return
true when something was changed.
(rename_ssa_copies): When something was changed, do
TODO_remove_unused_locals.
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_value):
add TODO_remove_unused_locals when instruction was removed.
2007-02-04 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (try_inline): Improve debug output; work on already * ipa-inline.c (try_inline): Improve debug output; work on already
inline edges too. inline edges too.
(cgraph_decide_inlining_incrementally): Indent; improve debug output; (cgraph_decide_inlining_incrementally): Indent; improve debug output;
......
...@@ -109,7 +109,7 @@ Boston, MA 02110-1301, USA. */ ...@@ -109,7 +109,7 @@ Boston, MA 02110-1301, USA. */
/* Coalesce the partitions in MAP representing VAR1 and VAR2 if it is valid. /* Coalesce the partitions in MAP representing VAR1 and VAR2 if it is valid.
Choose a representative for the partition, and send debug info to DEBUG. */ Choose a representative for the partition, and send debug info to DEBUG. */
static void static bool
copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
int p1, p2, p3; int p1, p2, p3;
...@@ -151,7 +151,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -151,7 +151,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : Already coalesced.\n"); fprintf (debug, " : Already coalesced.\n");
return; return false;
} }
/* Don't coalesce if one of the variables occurs in an abnormal PHI. */ /* Don't coalesce if one of the variables occurs in an abnormal PHI. */
...@@ -161,7 +161,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -161,7 +161,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n"); fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n");
return; return false;
} }
/* Partitions already have the same root, simply merge them. */ /* Partitions already have the same root, simply merge them. */
...@@ -170,7 +170,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -170,7 +170,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
p1 = partition_union (map->var_partition, p1, p2); p1 = partition_union (map->var_partition, p1, p2);
if (debug) if (debug)
fprintf (debug, " : Same root, coalesced --> P%d.\n", p1); fprintf (debug, " : Same root, coalesced --> P%d.\n", p1);
return; return false;
} }
/* Never attempt to coalesce 2 difference parameters. */ /* Never attempt to coalesce 2 difference parameters. */
...@@ -178,14 +178,14 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -178,14 +178,14 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : 2 different PARM_DECLS. No coalesce.\n"); fprintf (debug, " : 2 different PARM_DECLS. No coalesce.\n");
return; return false;
} }
if ((TREE_CODE (root1) == RESULT_DECL) != (TREE_CODE (root2) == RESULT_DECL)) if ((TREE_CODE (root1) == RESULT_DECL) != (TREE_CODE (root2) == RESULT_DECL))
{ {
if (debug) if (debug)
fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n"); fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n");
return; return false;
} }
ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1); ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1);
...@@ -203,7 +203,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -203,7 +203,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : 2 different USER vars. No coalesce.\n"); fprintf (debug, " : 2 different USER vars. No coalesce.\n");
return; return false;
} }
} }
...@@ -214,7 +214,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -214,7 +214,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : 2 memory tags. No coalesce.\n"); fprintf (debug, " : 2 memory tags. No coalesce.\n");
return; return false;
} }
/* If both values have default defs, we can't coalesce. If only one has a /* If both values have default defs, we can't coalesce. If only one has a
...@@ -225,7 +225,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -225,7 +225,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : 2 default defs. No coalesce.\n"); fprintf (debug, " : 2 default defs. No coalesce.\n");
return; return false;
} }
else else
{ {
...@@ -244,7 +244,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -244,7 +244,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : Incompatible types. No coalesce.\n"); fprintf (debug, " : Incompatible types. No coalesce.\n");
return; return false;
} }
/* Don't coalesce if the aliasing sets of the types are different. */ /* Don't coalesce if the aliasing sets of the types are different. */
...@@ -255,7 +255,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -255,7 +255,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
{ {
if (debug) if (debug)
fprintf (debug, " : 2 different aliasing sets. No coalesce.\n"); fprintf (debug, " : 2 different aliasing sets. No coalesce.\n");
return; return false;
} }
...@@ -283,6 +283,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ...@@ -283,6 +283,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
TDF_SLIM); TDF_SLIM);
fprintf (debug, "\n"); fprintf (debug, "\n");
} }
return true;
} }
...@@ -301,6 +302,7 @@ rename_ssa_copies (void) ...@@ -301,6 +302,7 @@ rename_ssa_copies (void)
tree phi, stmt, var, part_var; tree phi, stmt, var, part_var;
unsigned x; unsigned x;
FILE *debug; FILE *debug;
bool updated = false;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
debug = dump_file; debug = dump_file;
...@@ -321,7 +323,7 @@ rename_ssa_copies (void) ...@@ -321,7 +323,7 @@ rename_ssa_copies (void)
tree rhs = GIMPLE_STMT_OPERAND (stmt, 1); tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME) if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
copy_rename_partition_coalesce (map, lhs, rhs, debug); updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
} }
} }
} }
...@@ -342,7 +344,7 @@ rename_ssa_copies (void) ...@@ -342,7 +344,7 @@ rename_ssa_copies (void)
{ {
tree arg = PHI_ARG_DEF (phi, i); tree arg = PHI_ARG_DEF (phi, i);
if (TREE_CODE (arg) == SSA_NAME) if (TREE_CODE (arg) == SSA_NAME)
copy_rename_partition_coalesce (map, res, arg, debug); updated |= copy_rename_partition_coalesce (map, res, arg, debug);
} }
} }
} }
...@@ -374,7 +376,7 @@ rename_ssa_copies (void) ...@@ -374,7 +376,7 @@ rename_ssa_copies (void)
} }
delete_var_map (map); delete_var_map (map);
return 0; return updated ? TODO_remove_unused_locals : 0;
} }
/* Return true if copy rename is to be performed. */ /* Return true if copy rename is to be performed. */
......
...@@ -1003,6 +1003,7 @@ tree_ssa_forward_propagate_single_use_vars (void) ...@@ -1003,6 +1003,7 @@ tree_ssa_forward_propagate_single_use_vars (void)
if (forward_propagate_addr_expr (stmt, &some)) if (forward_propagate_addr_expr (stmt, &some))
{ {
release_defs (stmt); release_defs (stmt);
todoflags |= TODO_remove_unused_locals;
bsi_remove (&bsi, true); bsi_remove (&bsi, true);
} }
else else
......
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