blob: e95bc9bc76888c80c0c08138e99b0f2751e8487a (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/* PR tree-optimization/118430 */
/* { dg-do compile { target musttail } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]\*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = freddy \\\(\[^\n\r]\*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not " (?:bar|freddy) \\\(\[^\n\r]\*\\\); \\\[tail call\\\]" "optimized" } } */
__attribute__ ((noipa)) void
foo (int x)
{
(void) x;
}
__attribute__ ((noinline)) int
bar (int x)
{
foo (x);
return 1;
}
__attribute__ ((noinline)) int
baz (int *x)
{
foo (*x);
return 2;
}
__attribute__((noipa)) int
qux (int x)
{
{
int v;
foo (x);
baz (&v);
}
[[gnu::musttail]]
return bar (x);
}
__attribute__((noipa)) int
corge (int x)
{
{
int v;
foo (x);
baz (&v);
}
return bar (x) + 1;
}
__attribute__ ((noinline)) float
freddy (int x)
{
foo (x);
return 1.75f;
}
__attribute__((noipa)) float
garply (int x)
{
{
int v;
foo (x);
baz (&v);
}
[[gnu::musttail]]
return freddy (x);
}
__attribute__((noipa)) float
quux (int x)
{
{
int v;
foo (x);
baz (&v);
}
return freddy (x) + 0.25f;
}
int v;
int
main ()
{
qux (v);
corge (v);
garply (v);
quux (v);
}
|