From: Richard Guenther Date: Fri, 20 Apr 2012 11:56:33 +0000 (+0000) Subject: tree-ssa-copy.c (propagate_tree_value_into_stmt): Use update_call_from_tree when... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=faaf273bb0591fe719fcdd18b6c0941f98aa342b;p=gcc.git tree-ssa-copy.c (propagate_tree_value_into_stmt): Use update_call_from_tree when propagating into a call. 2012-04-20 Richard Guenther * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33ef4a77f66..68593c90b8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-04-20 Richard Guenther + + * tree-ssa-copy.c (propagate_tree_value_into_stmt): Use + update_call_from_tree when propagating into a call. + 2012-04-20 Alan Modra * config/rs6000/rs6000.c (rs6000_emit_savres_rtx): Formatting. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2faaaa59390..1cfffd8e7f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-04-20 Richard Guenther + + * g++.dg/torture/20120420-1.C: New testcase. + 2012-04-19 Steven Bosscher * gcc.target/i386/pr45830.c: Update scan-tree-dump. diff --git a/gcc/testsuite/g++.dg/torture/20120420-1.C b/gcc/testsuite/g++.dg/torture/20120420-1.C new file mode 100644 index 00000000000..ada0ab67e93 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/20120420-1.C @@ -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; + } +} diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 4c6d9927bbd..45b5c92c999 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -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);