Some fixes for profile test cases for autofdo
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / inliner-1.c
blob8d1481bfeb7882b7125865fdf143ae8b5c3ba081
1 /* { dg-options "-O2 -fdump-tree-optimized -fgnu89-inline" } */
2 int a;
3 int b[100];
4 void abort (void);
6 inline void
7 cold_function ()
9 int i;
10 for (i = 0; i < 99; i++)
11 if (b[i] / (b[i+1] + 1))
12 abort ();
15 inline void
16 hot_function ()
18 int i;
19 for (i = 0; i < 99; i++)
20 if (b[i] / (b[i+1] + 1))
21 abort ();
24 int
25 main ()
27 int i;
28 for (i = 0; i < 1000000; i++)
30 if (a)
31 cold_function ();
32 else
33 hot_function ();
35 return 0;
38 /* cold function should be inlined, while hot function should not.
39 Look for "cold_function () [tail call];" call statement not for the
40 declaration or other appearances of the string in dump. */
41 /* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */
42 /* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */