Debian Codegraph @

gcc/testsuite/g++.dg/tree-prof/morefunc.C

raw
1 /* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile-optimized -fdump-ipa-afdo-optimized -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */
2
3 #include "reorder_class1.h"
4 #include "reorder_class2.h"
5
6 int g;
7
8 #ifdef _PROFILE_USE
9 /* Another function not existing
10 * in profile-gen */
11
12 __attribute__((noinline)) void
13 new_func (int i)
14 {
15 g += i;
16 }
17 #endif
18
19 static __attribute__((always_inline))
20 void test1 (A *tc)
21 {
22 int i;
23 for (i = 0; i < 10000000; i++)
24 g += tc->foo();
25 if (g<100) g++;
26 }
27
28 static __attribute__((always_inline))
29 void test2 (B *tc)
30 {
31 int i;
32 for (i = 0; i < 10000000; i++)
33 g += tc->foo();
34 }
35
36
37 __attribute__((noinline)) void test_a(A *ap) { test1 (ap); }
38 __attribute__((noinline)) void test_b(B *bp) { test2 (bp); }
39
40
41 int main()
42 {
43 A* ap = new A();
44 B* bp = new B();
45
46 test_a(ap);
47 test_b(bp);
48
49 #ifdef _PROFILE_USE
50 new_func(10);
51 #endif
52
53 }
54
55 /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
56 /* { dg-final-use-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "afdo" } } */