view gcc/testsuite/gcc.dg/tree-prof/crossmodule-indir-call-topn-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* { dg-require-effective-target lto } */
/* { dg-additional-sources "crossmodule-indir-call-topn-1a.c" } */
/* { dg-require-profiling "-fprofile-generate" } */
/* { dg-options "-O2 -flto -DDOJOB=1 -fdump-ipa-profile_estimate" } */

#include <stdio.h>

typedef int (*fptr) (int);
int
one (int a);

int
two (int a);

fptr table[] = {&one, &two};

int
main()
{
  int i, x;
  fptr p = &one;

  x = one (3);

  for (i = 0; i < 350000000; i++)
    {
      x = (*p) (3);
      p = table[x];
    }
  printf ("done:%d\n", x);
}

/* { dg-final-use-not-autofdo { scan-pgo-wpa-ipa-dump "2 \\(200.00%\\) speculations produced." "profile_estimate" } } */