PR tree-optimization/59386
* tree-inline.c (remap_gimple_stmt): If not id->do_not_unshare,
unshare_expr (id->retval) before passing it to gimple_build_assign.
* gcc.c-torture/compile/pr59386.c: New test.
From-SVN: r205883
+2013-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59386
+ * tree-inline.c (remap_gimple_stmt): If not id->do_not_unshare,
+ unshare_expr (id->retval) before passing it to gimple_build_assign.
+
2013-12-11 Bin Cheng <bin.cheng@arm.com>
Reverted:
+2013-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/59386
+ * gcc.c-torture/compile/pr59386.c: New test.
+
2013-12-11 Bin Cheng <bin.cheng@arm.com>
Reverted:
--- /dev/null
+/* PR tree-optimization/59386 */
+
+struct S { int s; };
+struct T { int t; struct S u; } c;
+int b;
+
+struct S
+foo ()
+{
+ struct T d;
+ if (b)
+ while (c.t)
+ ;
+ else
+ return d.u;
+}
+
+struct S
+bar ()
+{
+ struct T a;
+ a.u = foo ();
+ return a.u;
+}
|| ! SSA_NAME_VAR (retval)
|| TREE_CODE (SSA_NAME_VAR (retval)) != RESULT_DECL)))
{
- copy = gimple_build_assign (id->retvar, retval);
+ copy = gimple_build_assign (id->do_not_unshare
+ ? id->retvar : unshare_expr (id->retvar),
+ retval);
/* id->retvar is already substituted. Skip it on later remapping. */
skip_first = true;
}