blob: b57d30f916372c17b9987e9920a6bc138dffbca4 [file] [log] [blame]
/* { dg-require-effective-target lto } */
/* { dg-additional-sources "crossmodule-indir-call-topn-1a.c" } */
/* { dg-require-profiling "-fprofile-generate" } */
/* { dg-options "-O2 -flto -DDOJOB=1 -fdump-ipa-profile_estimate" } */
#ifdef FOR_AUTOFDO_TESTING
#define MAXITER 350000000
#else
#define MAXITER 3500000
#endif
#include <stdio.h>
typedef int (*fptr) (int);
int
one (int a);
int
two (int a);
fptr table[] = {&one, &two};
int
main()
{
int i, x;
fptr p = &one;
x = one (3);
for (i = 0; i < MAXITER; i++)
{
x = (*p) (3);
p = table[x];
}
printf ("done:%d\n", x);
}
/* { dg-final-use-not-autofdo { scan-pgo-wpa-ipa-dump "2 \\(200.00%\\) speculations produced." "profile_estimate" } } */