aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/ipa-cp-1.c
blob: ab6a7f7211f516bac50afa8c606aefa6ccab7fed (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
/* { dg-options "-O2 -fdump-ipa-cp" } */
__attribute__ ((used))
int a[1000];

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

__attribute__ ((noinline))
void
test1 (int sz)
{
  for (int i = 0; i < 1000; i++)
	  test2(sz);
}
int main()
{
	test1(1000);
	return 0;
}
/* We should clone test1 and test2 for constant 1000.
   In the past we did not do this since we did not clone for edges that are not hot
   and call main->test1 is not considered hot since it is executed just once.  */
/* { dg-final-use { scan-ipa-dump-times "Creating a specialized node of test1" 1 "cp"} } */
/* { dg-final-use { scan-ipa-dump-times "Creating a specialized node of test2" 1 "cp"} } */