summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/flatten-1.c
blob: 2eb41e5b466546034ee6145430a43454af8d40ef (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* { dg-do compile } */
/* { dg-options -O2 } */

/* Basic tests for flatten attribute, check we end up
   with only the flattened function bodies.  */

static int foobar(int i);
static int bar(int i);

int __attribute__((flatten)) leaf0a(int i)
{
  return bar(i);
}
int __attribute__((flatten)) leaf0b(int i)
{
  return foobar(i);
}
int __attribute__((flatten)) leaf1(int i)
{
  return bar(foobar(i));
}
int __attribute__((flatten)) leaf2(int i)
{
  int j;
  j = foobar(i);
  return bar(j);
}

static int foobar(int i)
{
  return i-1;
}
static int bar(int i)
{
  return i + foobar(i);
}


static int gloobar(int i)
{
  return i*5+1;
}
static int floobar(int i)
{
  return gloobar(i);
}
int __attribute__((flatten)) leaf3(int i)
{
  int j;
  j = floobar(i);
  j += floobar(i);
  return j;
}

/* { dg-final { scan-assembler-not "bar\[: \t\n\]" } } */