Some fixes for profile test cases for autofdo
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / indir-call-prof.c
blob53063c3e7fa619d1f3e02f8dafba8970dd53d2a9
1 /* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile -fdump-ipa-afdo" } */
3 static int a1 (void)
5 return 10;
8 static int a2 (void)
10 return 0;
13 typedef int (*tp) (void);
15 static tp aa [] = {a2, a1, a1, a1, a1};
17 void setp (int (**pp) (void), int i)
19 if (!i)
20 *pp = aa [i];
21 else
22 *pp = aa [(i & 2) + 1];
25 int
26 main (void)
28 int (*p) (void);
29 int i;
31 for (i = 0; i < 10000000; i ++)
33 setp (&p, i);
34 p ();
37 return 0;
40 /* { dg-final-use-not-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "profile"} } */
41 /* { dg-final-use-autofdo { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "afdo"} } */
42 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */