aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ipa-icf-gimple.cc3
-rw-r--r--gcc/testsuite/c-c++-common/musttail27.c31
2 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ipa-icf-gimple.cc b/gcc/ipa-icf-gimple.cc
index 51ca8a3..ac16986 100644
--- a/gcc/ipa-icf-gimple.cc
+++ b/gcc/ipa-icf-gimple.cc
@@ -708,7 +708,8 @@ func_checker::compare_gimple_call (gcall *s1, gcall *s2)
|| gimple_call_from_thunk_p (s1) != gimple_call_from_thunk_p (s2)
|| gimple_call_from_new_or_delete (s1) != gimple_call_from_new_or_delete (s2)
|| gimple_call_va_arg_pack_p (s1) != gimple_call_va_arg_pack_p (s2)
- || gimple_call_alloca_for_var_p (s1) != gimple_call_alloca_for_var_p (s2))
+ || gimple_call_alloca_for_var_p (s1) != gimple_call_alloca_for_var_p (s2)
+ || gimple_call_must_tail_p (s1) != gimple_call_must_tail_p (s2))
return false;
unsigned check_arg_types_from = 0;
diff --git a/gcc/testsuite/c-c++-common/musttail27.c b/gcc/testsuite/c-c++-common/musttail27.c
new file mode 100644
index 0000000..2a92bcb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/musttail27.c
@@ -0,0 +1,31 @@
+/* PR ipa/119376 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 2 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(\[^\n\r]*\\\); \\\[tail call\\\]" 4 "optimized" } } */
+
+int foo (int);
+
+int
+bar (int x)
+{
+ [[gnu::musttail]] return foo (x + 1);
+}
+
+int
+baz (int x)
+{
+ return foo (x + 1);
+}
+
+int
+qux (int x)
+{
+ return foo (x + 2);
+}
+
+int
+corge (int x)
+{
+ [[gnu::musttail]] return foo (x + 2);
+}