view gcc/testsuite/g++.dg/tree-prof/morefunc.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line source

/* { dg-options "-O2 -fno-devirtualize --param=profile-func-internal-id=0 -fdump-ipa-profile -fdump-ipa-afdo -Wno-attributes -Wno-coverage-mismatch -Wno-missing-profile" } */
#include "reorder_class1.h"
#include "reorder_class2.h"

int g;

#ifdef _PROFILE_USE
/* Another function not existing
 * in profile-gen  */

__attribute__((noinline)) void
new_func (int i)
{
   g += i;
}
#endif

static __attribute__((always_inline))
void test1 (A *tc)
{
  int i;
  for (i = 0; i < 1000; i++)
     g += tc->foo(); 
   if (g<100) g++;
}

static __attribute__((always_inline))
void test2 (B *tc)
{
  int i;
  for (i = 0; i < 1000000; i++)
     g += tc->foo();
}


__attribute__((noinline)) void test_a(A *ap) { test1 (ap); }
__attribute__((noinline)) void test_b(B *bp) { test2 (bp); }


int main()
{
  A* ap = new A();
  B* bp = new B();

  test_a(ap);
  test_b(bp);

#ifdef _PROFILE_USE
  new_func(10);
#endif

}

/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */
/* { dg-final-use-autofdo { scan-ipa-dump-times "Indirect call -> direct call" 2 "afdo" } } */