Commit eb6b98c7 by Richard Guenther Committed by Richard Biener

tree-ssa-ccp.c (ccp_fold_stmt): Unshare values we substitute.

2010-01-29  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-ccp.c (ccp_fold_stmt): Unshare values we substitute.
	Assert we successfully updated the call.

From-SVN: r156346
parent c23cd1d6
2010-01-29 Richard Guenther <rguenther@suse.de>
* tree-ssa-ccp.c (ccp_fold_stmt): Unshare values we substitute.
Assert we successfully updated the call.
2010-01-29 Jakub Jelinek <jakub@redhat.com> 2010-01-29 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/42889 PR rtl-optimization/42889
......
...@@ -1518,11 +1518,13 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi) ...@@ -1518,11 +1518,13 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
&& (val = get_value (lhs)) && (val = get_value (lhs))
&& val->lattice_val == CONSTANT) && val->lattice_val == CONSTANT)
{ {
tree new_rhs = val->value; tree new_rhs = unshare_expr (val->value);
bool res;
if (!useless_type_conversion_p (TREE_TYPE (lhs), if (!useless_type_conversion_p (TREE_TYPE (lhs),
TREE_TYPE (new_rhs))) TREE_TYPE (new_rhs)))
new_rhs = fold_convert (TREE_TYPE (lhs), new_rhs); new_rhs = fold_convert (TREE_TYPE (lhs), new_rhs);
update_call_from_tree (gsi, new_rhs); res = update_call_from_tree (gsi, new_rhs);
gcc_assert (res);
return true; return true;
} }
...@@ -1542,7 +1544,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi) ...@@ -1542,7 +1544,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
(TYPE_MAIN_VARIANT (TREE_VALUE (argt)), (TYPE_MAIN_VARIANT (TREE_VALUE (argt)),
TYPE_MAIN_VARIANT (TREE_TYPE (val->value)))) TYPE_MAIN_VARIANT (TREE_TYPE (val->value))))
{ {
gimple_call_set_arg (stmt, i, val->value); gimple_call_set_arg (stmt, i, unshare_expr (val->value));
changed = true; changed = true;
} }
} }
......
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