+2011-02-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/47632
+ * tree-ssa-forwprop.c (remove_prop_source_from_use): Remove
+ unused up_to_stmt parameter, return whether cfg-cleanup is
+ necessary, remove EH info properly.
+ (forward_propagate_into_gimple_cond): Adjust caller.
+ (forward_propagate_into_cond): Likewise.
+ (forward_propagate_comparison): Likewise.
+ (tree_ssa_forward_propagate_single_use_vars): Make
+ forward_propagate_comparison case similar to the two others.
+
2011-02-08 Nick Clifton <nickc@redhat.com>
* config/mn10300/mn10300.opt (mliw): New command line option.
return true;
}
-/* Remove a copy chain ending in NAME along the defs but not
- further or including UP_TO_STMT. If NAME was replaced in
- its only use then this function can be used to clean up
- dead stmts. Returns true if UP_TO_STMT can be removed
- as well, otherwise false. */
+/* Remove a copy chain ending in NAME along the defs.
+ If NAME was replaced in its only use then this function can be used
+ to clean up dead stmts. Returns true if cleanup-cfg has to run. */
static bool
-remove_prop_source_from_use (tree name, gimple up_to_stmt)
+remove_prop_source_from_use (tree name)
{
gimple_stmt_iterator gsi;
gimple stmt;
+ bool cfg_changed = false;
do {
+ basic_block bb;
+
if (!has_zero_uses (name))
- return false;
+ return cfg_changed;
stmt = SSA_NAME_DEF_STMT (name);
- if (stmt == up_to_stmt)
- return true;
-
gsi = gsi_for_stmt (stmt);
+ bb = gimple_bb (stmt);
release_defs (stmt);
gsi_remove (&gsi, true);
+ cfg_changed |= gimple_purge_dead_eh_edges (bb);
name = (gimple_assign_copy_p (stmt)) ? gimple_assign_rhs1 (stmt) : NULL;
} while (name && TREE_CODE (name) == SSA_NAME);
- return false;
+ return cfg_changed;
}
/* Return the rhs of a gimple_assign STMT in a form of a single tree,
update_stmt (stmt);
/* Remove defining statements. */
- remove_prop_source_from_use (name, NULL);
-
- if (is_gimple_min_invariant (tmp))
+ if (remove_prop_source_from_use (name)
+ || is_gimple_min_invariant (tmp))
did_something = 2;
else if (did_something == 0)
did_something = 1;
update_stmt (stmt);
/* Remove defining statements. */
- remove_prop_source_from_use (name, NULL);
-
- if (is_gimple_min_invariant (tmp))
+ if (remove_prop_source_from_use (name)
+ || is_gimple_min_invariant (tmp))
did_something = 2;
else if (did_something == 0)
did_something = 1;
update_stmt (use_stmt);
}
- /* Remove defining statements. */
- remove_prop_source_from_use (name, stmt);
-
if (dump_file && (dump_flags & TDF_DETAILS))
{
tree old_rhs = rhs_to_tree (TREE_TYPE (gimple_assign_lhs (stmt)),
fprintf (dump_file, "'\n");
}
- return true;
+ /* Remove defining statements. */
+ return remove_prop_source_from_use (name);
}
return false;
== tcc_comparison)
{
if (forward_propagate_comparison (stmt))
- {
- release_defs (stmt);
- todoflags |= TODO_remove_unused_locals;
- gsi_remove (&gsi, true);
- }
- else
- gsi_next (&gsi);
+ cfg_changed = true;
+ gsi_next (&gsi);
}
else if (gimple_assign_rhs_code (stmt) == BIT_AND_EXPR)
{