blob: 2f208e591c70cd12478e27665840eda936d183f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// gcc -g -O2 -freorder-blocks-and-partition
const char *arr[10000];
const char *hot = "hot";
const char *cold = "cold";
__attribute__((noinline))
void fn(int path) {
int i;
if (path) {
for (i = 0; i < sizeof arr / sizeof arr[0]; i++) {
arr[i] = hot;
}
} else {
for (i = 0; i < sizeof arr / sizeof arr[0]; i++) {
arr[i] = cold;
}
}
}
int main(int argc, char *argv[]) {
fn(argc);
return 0;
}
|