diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab552be3bb0de7fb5c4e82184002d9d37745d9be..939bea1d9f9ac3fb8b624f25ff9ddc79cf599e54 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/testsuite/gcc.dg/pr51879-16.c b/gcc/testsuite/gcc.dg/pr51879-16.c new file mode 100644 index 0000000000000000000000000000000000000000..3a84e9746933355be423dfa1272f323f0faa985d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51879-16.c @@ -0,0 +1,32 @@ +/* { 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" } } */ diff --git a/gcc/testsuite/gcc.dg/pr51879-17.c b/gcc/testsuite/gcc.dg/pr51879-17.c new file mode 100644 index 0000000000000000000000000000000000000000..806fe7b0f61a76934d27a39d207e5c1fc329b24a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51879-17.c @@ -0,0 +1,32 @@ +/* { 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" } } */