2012-07-06  Tom de Vries  <tom@codesourcery.com>
	PR tree-optimization/51879
	* gcc.dg/pr51879-16.c: New test.
	* gcc.dg/pr51879-17.c: Same.
From-SVN: r189324
+2012-07-06  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/51879
+       * gcc.dg/pr51879-16.c: New test.
+       * gcc.dg/pr51879-17.c: Same.
+
 2012-07-06  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/52009
 
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre" } */
+
+struct S {
+  int i;
+};
+
+extern struct S foo (void);
+extern int foo2 (void);
+
+struct S s;
+
+int bar (int c) {
+  int r;
+
+  if (c)
+    {
+      s = foo ();
+      r = foo2 ();
+    }
+  else
+    {
+      s = foo ();
+      r = foo2 ();
+    }
+
+  return r;
+}
+
+/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */
+/* { dg-final { scan-tree-dump-times "foo2 \\(" 1 "pre"} } */
+/* { dg-final { cleanup-tree-dump "pre" } } */
 
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre" } */
+
+struct S {
+  int i;
+};
+
+extern struct S foo (void);
+extern int foo2 (void);
+
+struct S s, s2;
+
+int bar (int c) {
+  int r;
+
+  if (c)
+    {
+      s = foo ();
+      r = foo2 ();
+    }
+  else
+    {
+      s2 = foo ();
+      r = foo2 ();
+    }
+
+  return r;
+}
+
+/* { dg-final { scan-tree-dump-times "foo \\(" 2 "pre"} } */
+/* { dg-final { scan-tree-dump-times "foo2 \\(" 2 "pre"} } */
+/* { dg-final { cleanup-tree-dump "pre" } } */