From: Jan Hubicka Date: Tue, 17 Jun 2025 13:43:13 +0000 (+0200) Subject: Add testcase for AFDO early inlining and indirect call promotion X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d1d893a00d6a46e8f090ad29715693b6c04a78f;p=thirdparty%2Fgcc.git Add testcase for AFDO early inlining and indirect call promotion gcc/testsuite/ChangeLog: * gcc.dg/tree-prof/afdo-vpt-earlyinline.c: New test. --- diff --git a/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c b/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c new file mode 100644 index 00000000000..3b51ea9f8a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/afdo-vpt-earlyinline.c @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-ipa-afdo-details -fdump-tree-einline-details" } */ +/* { dg-require-profiling "-fauto-profile" } */ + +volatile int array[1000]; +int reta (int i) +{ + return array[i]; +} +struct wrapptr +{ + int (*ret)(int); +}; +int test (struct wrapptr *p) +{ + int s = 0; + for (int pos = 0; pos < 1000; pos++) + s+p->ret(pos); + if (s) + __builtin_printf ("sum error\n"); +} +int main() +{ + struct wrapptr p={reta}; + for (int i = 0; i < 10000; i++) + test(&p); + return 0; +} +/* { dg-final-use-autofdo { scan-tree-dump "Inlining test" "einline"} } */ +/* { dg-final-use-autofdo { scan-ipa-dump "Checking indirect call -> direct call reta" "afdo"} } */ +/* { dg-final-use-autofdo { scan-ipa-dump "looks good" "afdo"} } */ +/* If we inlined reta->test->main, it will contian array[pos]. */ +/* { dg-final-use-autofdo { scan-ipa-dump "array.pos_" "afdo"} } */