aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
blob: 904dd0cfb28afdf6d7966da2c4de29a97e16f289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-afdo_offline-all" } */
/* { dg-require-profiling "-fauto-profile" } */ 

__attribute__ ((used))
int a[1000];

__attribute__ ((noinline))
void
test2(int sz)
{
  a[sz]++;
  asm volatile (""::"m"(a));
}

__attribute__ ((noinline))
void
test1 (int sz)
{
  for (int i = 0; i < 1000; i++)
    if (i % 2)
      test2 (sz);
    else
      test2 (i);

}
int main()
{
  for (int i = 0; i < 1000; i++)
    test1 (1000);
  return 0;
}
/* We will have profiles for test2 and test2.constprop.0 that will have to be
   merged,  */
/* { dg-final-use-autofdo { scan-ipa-dump "Merging duplicate instance: test2" "afdo_offline"} } */