Skip to content

Commit 3d1d893

Browse files
committed
Add testcase for AFDO early inlining and indirect call promotion
gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/afdo-vpt-earlyinline.c: New test.
1 parent 4ff09eb commit 3d1d893

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* { dg-options "-O2 -fdump-ipa-afdo-details -fdump-tree-einline-details" } */
2+
/* { dg-require-profiling "-fauto-profile" } */
3+
4+
volatile int array[1000];
5+
int reta (int i)
6+
{
7+
return array[i];
8+
}
9+
struct wrapptr
10+
{
11+
int (*ret)(int);
12+
};
13+
int test (struct wrapptr *p)
14+
{
15+
int s = 0;
16+
for (int pos = 0; pos < 1000; pos++)
17+
s+p->ret(pos);
18+
if (s)
19+
__builtin_printf ("sum error\n");
20+
}
21+
int main()
22+
{
23+
struct wrapptr p={reta};
24+
for (int i = 0; i < 10000; i++)
25+
test(&p);
26+
return 0;
27+
}
28+
/* { dg-final-use-autofdo { scan-tree-dump "Inlining test" "einline"} } */
29+
/* { dg-final-use-autofdo { scan-ipa-dump "Checking indirect call -> direct call reta" "afdo"} } */
30+
/* { dg-final-use-autofdo { scan-ipa-dump "looks good" "afdo"} } */
31+
/* If we inlined reta->test->main, it will contian array[pos]. */
32+
/* { dg-final-use-autofdo { scan-ipa-dump "array.pos_" "afdo"} } */

0 commit comments

Comments
 (0)