From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c (limited to 'gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c b/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c new file mode 100644 index 000000000..ffed23cf4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c @@ -0,0 +1,85 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-early-inlining" } */ + +extern void do_something_usefull(); +/* Check that we finish compiling even if instructed to + flatten a cyclic callgraph. Verify we correctly + flatten with another function marked flatten in the + callgraph. + + Main inline is cureful about indirect calls giving + precedence to breaking cycle at indirect call sites. + Early inliner can't do similar analysis, so we need + to disable it if we want cycles to be broken consistently. */ + +void __attribute__((flatten)) direct(void) +{ + direct(); +} + + +void __attribute__((flatten)) indirect(void); +static void indirect1(void) +{ + indirect(); +} +void __attribute__((flatten)) indirect(void) +{ + indirect1(); +} + + +void __attribute__((flatten)) doubleindirect(void); +static void doubleindirect2(void) +{ + doubleindirect(); + do_something_usefull (); +} +static void doubleindirect1(void) +{ + doubleindirect2(); +} +void __attribute__((flatten)) doubleindirect(void) +{ + doubleindirect1(); +} + + +static void subcycle1(void); +static void subcycle2(void) +{ + subcycle1(); + do_something_usefull (); +} +static void subcycle1(void) +{ + subcycle2(); +} +void __attribute__((flatten)) subcycle(void) +{ + subcycle1(); +} + + +static void doublesubcycle1(void); +static void doublesubcycle2(void); +static void doublesubcycle3(void) +{ + doublesubcycle1(); + do_something_usefull (); +} +static void doublesubcycle2(void) +{ + doublesubcycle3(); +} +static void doublesubcycle1(void) +{ + doublesubcycle2(); +} +void __attribute__((flatten)) doublesubcycle(void) +{ + doublesubcycle1(); +} + +/* { dg-final { scan-assembler "cycle\[123\]\[: \t\n\]" } } */ +/* { dg-final { scan-assembler-not "indirect\[12\]\[: \t\n\]" } } */ -- cgit v1.2.3