Debian Codegraph @

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

raw
1 /* PR c/119311 */
2 /* { dg-do compile { target musttail } } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " \[^\n\r]* = bar \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
5 /* { dg-final { scan-tree-dump-times " \[^\n\r]* = baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
6 /* { dg-final { scan-tree-dump-not " (?:bar|baz) \\\(\[^\n\r]*\\\); \\\[tail call\\\]" "optimized" } } */
7
8
9 [[gnu::noipa]] int
10 bar (int x, int y)
11 {
12 return x + y;
13 }
14
15 [[gnu::noipa]] int
16 baz (int x, int y)
17 {
18 return x * y;
19 }
20
21 int
22 foo (int a, int b)
23 {
24 if (a > b)
25 [[gnu::musttail]] return bar (a - b, b);
26 else
27 [[gnu::musttail]] return baz (a, b - a);
28 }