aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr119493-2.c
blob: 951529f698feae945e8818178bf399a82c532a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR tree-optimization/119493 */
/* { dg-do compile { target musttail } } */
/* { dg-options "-O2 -fdump-tree-tailr1-details" } */
/* { dg-final { scan-tree-dump-times "tail recursion with accumulation mixed with musttail non-recursive call" 2 "tailr1" } } */

[[gnu::noipa]] int
bar (int x, int y)
{
  return x + y;
}

[[gnu::noinline, gnu::noclone]] int
foo (int x, int y)
{
  if (x < 10)
    [[gnu::musttail]] return bar (x, y);
  if (y & 2)
    return foo (x - 1, y) * 2;
  if (y & 1)
    [[gnu::musttail]] return foo (x - 1, y);
  return foo (x - 1, y) * 3;
}