| 1 |
/* { dg-require-effective-target lto } */ |
| 2 |
/* { dg-require-profiling "-fprofile-generate" } */ |
| 3 |
/* { dg-additional-sources "crossmodule-indir-call-topn-1a.c" } */ |
| 4 |
/* { dg-options "-O2 -flto -DDOJOB=1 -fdump-ipa-profile_estimate" } */ |
| 5 |
|
| 6 |
#ifdef FOR_AUTOFDO_TESTING |
| 7 |
#define MAXITER 350000000 |
| 8 |
#else |
| 9 |
#define MAXITER 3500000 |
| 10 |
#endif |
| 11 |
|
| 12 |
#include <stdio.h> |
| 13 |
|
| 14 |
typedef int (*fptr) (int); |
| 15 |
int |
| 16 |
one (int a); |
| 17 |
|
| 18 |
int |
| 19 |
two (int a); |
| 20 |
|
| 21 |
fptr table[] = {&one, &two}; |
| 22 |
|
| 23 |
int foo () |
| 24 |
{ |
| 25 |
int i, x; |
| 26 |
fptr p = &one; |
| 27 |
|
| 28 |
x = one (3); |
| 29 |
|
| 30 |
for (i = 0; i < MAXITER; i++) |
| 31 |
{ |
| 32 |
x = (*p) (3); |
| 33 |
p = table[x]; |
| 34 |
} |
| 35 |
return x; |
| 36 |
} |
| 37 |
|
| 38 |
int |
| 39 |
main() |
| 40 |
{ |
| 41 |
int x = foo (); |
| 42 |
printf ("done:%d\n", x); |
| 43 |
} |
| 44 |
|
| 45 |
/* { dg-final-use-not-autofdo { scan-pgo-wpa-ipa-dump "2 \\(200.00%\\) speculations produced." "profile_estimate" } } */ |
| 46 |
|