Make FDO more tolerant to source changes
[official-gcc.git] / gcc / testsuite / g++.dg / tree-prof / morefunc.C
blobd5cee40cd26953d0b96e9dd3184c5351893a143c
1 /* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -Wno-attributes -Wno-coverage-mismatch" } */
2 #include "reorder_class1.h"
3 #include "reorder_class2.h"
5 int g;
7 #ifdef _PROFILE_USE
8 /* Another function not existing
9  * in profile-gen  */
11 __attribute__((noinline)) void
12 new_func (int i)
14    g += i;
16 #endif
18 static __attribute__((always_inline))
19 void test1 (A *tc)
21   int i;
22   for (i = 0; i < 1000; i++)
23      g += tc->foo(); 
24    if (g<100) g++;
27 static __attribute__((always_inline))
28 void test2 (B *tc)
30   int i;
31   for (i = 0; i < 1000; i++)
32      g += tc->foo();
36 __attribute__((noinline)) void test_a(A *ap) { test1 (ap); }
37 __attribute__((noinline)) void test_b(B *bp) { test2 (bp); }
40 int main()
42   A* ap = new A();
43   B* bp = new B();
45   test_a(ap);
46   test_b(bp);
48 #ifdef _PROFILE_USE
49   new_func(10);
50 #endif
54 /* { dg-final-use { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */