| 1 |
/* PR ipa/119376 */ |
| 2 |
/* { dg-do compile { target musttail } } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(3, \[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ |
| 5 |
/* { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(4, \[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ |
| 6 |
/* { dg-final { scan-tree-dump-not " foo \\\(\[12], \[^\n\r]*\\\); \\\[tail call\\\]" "optimized" } } */ |
| 7 |
|
| 8 |
int foo (int, int); |
| 9 |
int v, w[10]; |
| 10 |
|
| 11 |
static inline __attribute__((always_inline)) int |
| 12 |
bar (int x, int y) |
| 13 |
{ |
| 14 |
[[gnu::musttail]] return foo (x, y); |
| 15 |
} |
| 16 |
|
| 17 |
static int |
| 18 |
baz (int x, int y) |
| 19 |
{ |
| 20 |
[[gnu::musttail]] return foo (x, x + y + (v | y) * (v & y)); |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
qux (int x, int y) |
| 25 |
{ |
| 26 |
w[0] = bar (1, x + y); |
| 27 |
w[1] = baz (2, x + y); |
| 28 |
if (x == 42) |
| 29 |
[[gnu::musttail]] return bar (3, x + y); |
| 30 |
if (x == -42) |
| 31 |
[[gnu::musttail]] return baz (4, x + y); |
| 32 |
return 0; |
| 33 |
} |