PR tree-optimization/33562
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / flatten-2.c
blobffed23cf4546c08c6c98e3fd72d9ba21f736b4d7
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-early-inlining" } */
4 extern void do_something_usefull();
5 /* Check that we finish compiling even if instructed to
6 flatten a cyclic callgraph. Verify we correctly
7 flatten with another function marked flatten in the
8 callgraph.
10 Main inline is cureful about indirect calls giving
11 precedence to breaking cycle at indirect call sites.
12 Early inliner can't do similar analysis, so we need
13 to disable it if we want cycles to be broken consistently. */
15 void __attribute__((flatten)) direct(void)
17 direct();
21 void __attribute__((flatten)) indirect(void);
22 static void indirect1(void)
24 indirect();
26 void __attribute__((flatten)) indirect(void)
28 indirect1();
32 void __attribute__((flatten)) doubleindirect(void);
33 static void doubleindirect2(void)
35 doubleindirect();
36 do_something_usefull ();
38 static void doubleindirect1(void)
40 doubleindirect2();
42 void __attribute__((flatten)) doubleindirect(void)
44 doubleindirect1();
48 static void subcycle1(void);
49 static void subcycle2(void)
51 subcycle1();
52 do_something_usefull ();
54 static void subcycle1(void)
56 subcycle2();
58 void __attribute__((flatten)) subcycle(void)
60 subcycle1();
64 static void doublesubcycle1(void);
65 static void doublesubcycle2(void);
66 static void doublesubcycle3(void)
68 doublesubcycle1();
69 do_something_usefull ();
71 static void doublesubcycle2(void)
73 doublesubcycle3();
75 static void doublesubcycle1(void)
77 doublesubcycle2();
79 void __attribute__((flatten)) doublesubcycle(void)
81 doublesubcycle1();
84 /* { dg-final { scan-assembler "cycle\[123\]\[: \t\n\]" } } */
85 /* { dg-final { scan-assembler-not "indirect\[12\]\[: \t\n\]" } } */