| 1 |
/* { dg-options "-O2 -fdump-tree-optimized-blocks-details -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */ |
| 2 |
|
| 3 |
struct A { |
| 4 |
A () {} |
| 5 |
|
| 6 |
virtual int AA (void) |
| 7 |
{ return 0; } |
| 8 |
|
| 9 |
}; |
| 10 |
|
| 11 |
struct B : public A { |
| 12 |
B () {} |
| 13 |
|
| 14 |
virtual int AA (void) |
| 15 |
{ return 1; } |
| 16 |
}; |
| 17 |
|
| 18 |
void * __attribute__((noinline,noclone)) wrap (void *p) { return p; } |
| 19 |
int |
| 20 |
main (void) |
| 21 |
{ |
| 22 |
A a; |
| 23 |
B b; |
| 24 |
|
| 25 |
A* p; |
| 26 |
|
| 27 |
int i; |
| 28 |
|
| 29 |
for (i = 0; i < 10000000; i++) |
| 30 |
{ |
| 31 |
p = (A *)wrap ((void *)&a); |
| 32 |
p->AA (); |
| 33 |
|
| 34 |
p = (B *)wrap ((void *)&b); |
| 35 |
p->AA (); |
| 36 |
} |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |
| 40 |
|
| 41 |
/* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* AA .will resolve by ipa-profile" "profile" } } */ |
| 42 |
/* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* AA .will resolve by ipa-profile" "afdo" } } */ |
| 43 |
/* { dg-final-use-not-autofdo { scan-tree-dump-not "Invalid sum" "optimized" } } */ |