Debian Codegraph @

gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c

raw
1 /* { dg-options "-O2 -fdump-tree-optimized-details-blocks -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized" } */
2
3 static int a1 (void)
4 {
5 return 10;
6 }
7
8 static int a2 (void)
9 {
10 return 0;
11 }
12
13 typedef int (*tp) (void);
14
15 static tp aa [] = {a2, a1, a1, a1, a1};
16
17 void setp (int (**pp) (void), int i)
18 {
19 if (!i)
20 *pp = aa [i];
21 else
22 *pp = aa [(i & 2) + 1];
23 }
24
25 int
26 main (void)
27 {
28 int (*p) (void);
29 int i;
30
31 for (i = 0; i < 10000000; i ++)
32 {
33 setp (&p, i);
34 p ();
35 }
36
37 return 0;
38 }
39
40 /* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 .will resolve by ipa-profile" "profile"} } */
41 /* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 .will resolve by ipa-profile" "afdo"} } */
42 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */