aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr119493-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr119493-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr119493-2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr119493-2.c b/gcc/testsuite/gcc.dg/pr119493-2.c
new file mode 100644
index 0000000..951529f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr119493-2.c
@@ -0,0 +1,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;
+}