| 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 \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 2 "optimized" } } |
| 5 |
// { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(\[^\n\r]*\\\); \\\[tail call\\\]" 3 "optimized" } } |
| 6 |
|
| 7 |
int foo (int x); |
| 8 |
typedef int (*F) (int); |
| 9 |
int v; |
| 10 |
|
| 11 |
inline int |
| 12 |
bar (int x) |
| 13 |
{ |
| 14 |
if (__builtin_expect (x == 42, 1)) |
| 15 |
return 1; |
| 16 |
[[gnu::musttail]] return foo (x + v * (x | v) * (x & v) * (x - v) * (x + v * v)); |
| 17 |
} |
| 18 |
|
| 19 |
int |
| 20 |
baz (int x) |
| 21 |
{ |
| 22 |
[[gnu::musttail]] return bar (x); |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
qux (int x) |
| 27 |
{ |
| 28 |
return bar (x + 1); |
| 29 |
} |
| 30 |
|
| 31 |
F |
| 32 |
corge () |
| 33 |
{ |
| 34 |
return &bar; |
| 35 |
} |