Some fixes for profile test cases for autofdo
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / cold_partition_label.c
blob6214e3629f254c0963528ec8aedf02e09c88b34a
1 /* Test case to check if function foo gets split and the cold function
2 gets a label. */
3 /* { dg-require-effective-target freorder } */
4 /* { dg-options "-O2 -freorder-blocks-and-partition -save-temps" } */
6 #define SIZE 10000
8 const char *sarr[SIZE];
9 const char *buf_hot;
10 const char *buf_cold;
12 __attribute__((noinline))
13 void
14 foo (int path)
16 int i;
17 if (path)
19 for (i = 0; i < SIZE; i++)
20 sarr[i] = buf_hot;
22 else
24 for (i = 0; i < SIZE; i++)
25 sarr[i] = buf_cold;
29 int
30 main (int argc, char *argv[])
32 int i;
33 buf_hot = "hello";
34 buf_cold = "world";
35 for (i = 0; i < 1000000; i++)
36 foo (argc);
37 return 0;
40 /* { dg-final-use { scan-assembler "foo\[._\]+cold\[\._\]+0" { target *-*-linux* *-*-gnu* } } } */
41 /* { dg-final-use { scan-assembler "size\[ \ta-zA-Z0-0\]+foo\[._\]+cold\[\._\]+0" { target *-*-linux* *-*-gnu* } } } */