aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c
blob: bd1e2c645ad139428c6057e6de41fbaba29099e3 (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
35
36
37
38
/* { dg-options "-O2 -fdump-tree-optimized --param inline-address-not-taken-function-emit-probability=100 --param inline-function-size-adjustment=0" } */
int a;
int b[100];
void abort (void);

inline void
cold_function ()
{
  int i;
  for (i = 0; i < 99; i++)
    if (b[i] / (b[i+1] + 1))
      abort ();
}

inline void
hot_function ()
{
  int i;
  for (i = 0; i < 99; i++)
    if (b[i] / (b[i+1] + 1))
      abort ();
}

main ()
{
  if (a)
    cold_function ();
  else
    hot_function ();
  return 0;
}

/* cold function should be inlined, while hot function should not.  
   Look for "cold_function () [tail call];" call statement not for the
   declaration or other apperances of the string in dump.  */
/* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */
/* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */
/* { dg-final-use { cleanup-tree-dump "optimized" } } */