tree-ssa-copy.c (propagate_tree_value_into_stmt): Use update_call_from_tree when propagating into a call.

2012-04-20  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-copy.c (propagate_tree_value_into_stmt): Use
	update_call_from_tree when propagating into a call.

	* g++.dg/torture/20120420-1.C: New testcase.

From-SVN: r186622
This commit is contained in:
Richard Guenther 2012-04-20 11:56:33 +00:00 committed by Richard Biener
parent a51e5fa2c2
commit faaf273bb0
4 changed files with 41 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2012-04-20 Richard Guenther <rguenther@suse.de>
* tree-ssa-copy.c (propagate_tree_value_into_stmt): Use
update_call_from_tree when propagating into a call.
2012-04-20 Alan Modra <amodra@gmail.com>
* config/rs6000/rs6000.c (rs6000_emit_savres_rtx): Formatting.

View File

@ -1,3 +1,7 @@
2012-04-20 Richard Guenther <rguenther@suse.de>
* g++.dg/torture/20120420-1.C: New testcase.
2012-04-19 Steven Bosscher <steven@gcc.gnu.org>
* gcc.target/i386/pr45830.c: Update scan-tree-dump.

View File

@ -0,0 +1,29 @@
// { dg-do compile }
int g, *gp[100];
struct V {
int* x;
int y;
};
void foo (V **p, V* end, int i)
{
*p = 0;
V* pp = *p;
int s = 100;
for (; pp < end; )
{
pp++;
(pp-1)->x = &g;
if (g)
{
if (g>10)
g++;
int *t = (int*) operator new (100);
(pp-1)->x = t;
}
else
s--;
gp[end-pp] = (pp-1)->x + s;
}
}

View File

@ -257,13 +257,11 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
else if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE)
{
gimple new_stmt;
tree expr = NULL_TREE;
bool res;
propagate_tree_value (&expr, val);
new_stmt = gimple_build_assign (gimple_call_lhs (stmt), expr);
move_ssa_defining_stmt_for_defs (new_stmt, stmt);
gsi_replace (gsi, new_stmt, false);
res = update_call_from_tree (gsi, expr);
gcc_assert (res);
}
else if (gimple_code (stmt) == GIMPLE_SWITCH)
propagate_tree_value (gimple_switch_index_ptr (stmt), val);