libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / cold_partition_label.c
blob15e1a97b1e6a5a645a6bbf8b13f376ec034cf40a
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 -fdump-tree-optimized-details-blocks" } */
6 #ifdef FOR_AUTOFDO_TESTING
7 #define MAXITER 1000000
8 #else
9 #define MAXITER 10000
10 #endif
12 #define SIZE 10000
14 const char *sarr[SIZE];
15 const char *buf_hot;
16 const char *buf_cold;
18 __attribute__((noinline))
19 void
20 foo (int path)
22 int i;
23 if (path)
25 for (i = 0; i < SIZE; i++)
26 sarr[i] = buf_hot;
28 else
30 for (i = 0; i < SIZE; i++)
31 sarr[i] = buf_cold;
35 int
36 main (int argc, char *argv[])
38 int i;
39 buf_hot = "hello";
40 buf_cold = "world";
41 for (i = 0; i < MAXITER; i++)
42 foo (argc);
43 return 0;
46 /* { dg-final-use-not-autofdo { scan-assembler "foo\[._\]+cold" { target *-*-linux* *-*-gnu* } } } */
47 /* { dg-final-use-not-autofdo { scan-assembler "size\[ \ta-zA-Z0-0\]+foo\[._\]+cold" { target *-*-linux* *-*-gnu* } } } */
48 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */