| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ |
| 3 |
|
| 4 |
int v1, v2; |
| 5 |
void f(int x, int y) |
| 6 |
{ |
| 7 |
if (x) goto A; |
| 8 |
if (y) goto B; |
| 9 |
return; |
| 10 |
|
| 11 |
A: __attribute__((cold)) |
| 12 |
v1 = x; |
| 13 |
return; |
| 14 |
|
| 15 |
B: __attribute__((hot)) |
| 16 |
v2 = y; |
| 17 |
return; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-final { scan-tree-dump-times "hot label heuristics" 1 "profile_estimate" } } */ |
| 21 |
/* { dg-final { scan-tree-dump-times "cold label heuristics" 1 "profile_estimate" } } */ |
| 22 |
/* { dg-final { scan-tree-dump-times "combined heuristics: 10.00%" 1 "profile_estimate" } } */ |
| 23 |
|
| 24 |
/* Note: we're attempting to match some number > 6000, i.e. > 60%. |
| 25 |
The exact number ought to be tweekable without having to juggle |
| 26 |
the testcase around too much. */ |
| 27 |
/* { dg-final { scan-tree-dump-times "combined heuristics: 90.00%" 1 "profile_estimate" } } */ |