Debian Codegraph @

gcc/testsuite/c-c++-common/pr118430.c

raw
1 /* PR tree-optimization/118430 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " bar \\\(\[^\n\r]\*\\\); \\\[tail call\\\]" 2 "optimized" } } */
5 /* { dg-final { scan-tree-dump-times " freddy \\\(\[^\n\r]\*\\\); \\\[tail call\\\]" 2 "optimized" } } */
6
7 __attribute__ ((noipa)) void
8 foo (int x)
9 {
10 (void) x;
11 }
12
13 __attribute__ ((noinline)) int
14 bar (int x)
15 {
16 foo (x);
17 return 1;
18 }
19
20 __attribute__ ((noinline)) int
21 baz (int *x)
22 {
23 foo (*x);
24 return 2;
25 }
26
27 __attribute__((noipa)) int
28 qux (int x)
29 {
30 {
31 int v;
32 foo (x);
33 baz (&v);
34 }
35 return bar (x);
36 }
37
38 __attribute__((noipa)) int
39 corge (int x)
40 {
41 {
42 int v;
43 foo (x);
44 baz (&v);
45 }
46 bar (x);
47 return 1;
48 }
49
50 __attribute__ ((noinline)) float
51 freddy (int x)
52 {
53 foo (x);
54 return 1.75f;
55 }
56
57 __attribute__((noipa)) float
58 garply (int x)
59 {
60 {
61 int v;
62 foo (x);
63 baz (&v);
64 }
65 return freddy (x);
66 }
67
68 __attribute__((noipa)) float
69 quux (int x)
70 {
71 {
72 int v;
73 foo (x);
74 baz (&v);
75 }
76 freddy (x);
77 return 1.75f;
78 }
79
80 int v;
81
82 int
83 main ()
84 {
85 qux (v);
86 corge (v);
87 garply (v);
88 quux (v);
89 }