| 1 |
/* PR tree-optimization/119493 */ |
| 2 |
/* { dg-do compile { target musttail } } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-tailr1-details" } */ |
| 4 |
/* { dg-final { scan-tree-dump-times "tail recursion with accumulation mixed with musttail non-recursive call" 2 "tailr1" } } */ |
| 5 |
|
| 6 |
[[gnu::noipa]] int |
| 7 |
bar (int x, int y) |
| 8 |
{ |
| 9 |
return x + y; |
| 10 |
} |
| 11 |
|
| 12 |
[[gnu::noinline, gnu::noclone]] int |
| 13 |
foo (int x, int y) |
| 14 |
{ |
| 15 |
if (x < 10) |
| 16 |
[[gnu::musttail]] return bar (x, y); |
| 17 |
if (y & 2) |
| 18 |
return foo (x - 1, y) * 2; |
| 19 |
if (y & 1) |
| 20 |
[[gnu::musttail]] return foo (x - 1, y); |
| 21 |
return foo (x - 1, y) * 3; |
| 22 |
} |