diff options
author | Jan Hubicka <jh@suse.cz> | 2009-05-15 17:23:06 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2009-05-15 15:23:06 +0000 |
commit | febbad93b1c59994c7bb083a2dae46950af92cb7 (patch) | |
tree | 3c1a3954b5d0640bb58c436818fbee7eb4cc2fc7 /gcc | |
parent | b51c6a2c924795975501a7775946933cd6d3f587 (diff) | |
download | gcc-febbad93b1c59994c7bb083a2dae46950af92cb7.zip gcc-febbad93b1c59994c7bb083a2dae46950af92cb7.tar.gz gcc-febbad93b1c59994c7bb083a2dae46950af92cb7.tar.bz2 |
flatten-2.c: Disable early inlining; add comment.
* flatten-2.c: Disable early inlining; add comment.
* flatten-3.c: New test based on flatten-2.c.
From-SVN: r147582
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/flatten-3.c | 79 |
3 files changed, 91 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 63c8e67..1cd470b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-05-15 Jan Hubicka <jh@suse.cz> + + * flatten-2.c: Disable early inlining; add comment. + * flatten-3.c: New test based on flatten-2.c. + 2009-05-15 Richard Guenther <rguenther@suse.de> PR tree-optimization/39999 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c b/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c index 52a865d..ffed23c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/flatten-2.c @@ -1,11 +1,16 @@ /* { dg-do compile } */ -/* { dg-options -O2 } */ +/* { 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. */ + 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) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/flatten-3.c b/gcc/testsuite/gcc.dg/tree-ssa/flatten-3.c new file mode 100644 index 0000000..a1edb91 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/flatten-3.c @@ -0,0 +1,79 @@ +/* { dg-do compile } */ +/* { dg-options -O2 } */ + +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. */ + +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\]" } } */ |