https://gcc.gnu.org/g:8805ad29924f43d2005784efc8f7d29f10b7f6d9

commit r15-2179-g8805ad29924f43d2005784efc8f7d29f10b7f6d9
Author: Andi Kleen <a...@gcc.gnu.org>
Date:   Sat Jul 20 16:09:25 2024 -0700

    Revert "Add tests for C/C++ musttail attributes"
    
    This reverts commit 37c4703ce84722b9c24db3e8e6d57ab6d3a7b5eb.

Diff:
---
 gcc/testsuite/c-c++-common/musttail1.c  | 14 --------
 gcc/testsuite/c-c++-common/musttail12.c | 15 ---------
 gcc/testsuite/c-c++-common/musttail13.c |  5 ---
 gcc/testsuite/c-c++-common/musttail2.c  | 33 ------------------
 gcc/testsuite/c-c++-common/musttail3.c  | 29 ----------------
 gcc/testsuite/c-c++-common/musttail4.c  | 17 ----------
 gcc/testsuite/c-c++-common/musttail5.c  | 28 ---------------
 gcc/testsuite/c-c++-common/musttail7.c  | 14 --------
 gcc/testsuite/c-c++-common/musttail8.c  | 17 ----------
 gcc/testsuite/g++.dg/musttail10.C       | 40 ----------------------
 gcc/testsuite/g++.dg/musttail11.C       | 33 ------------------
 gcc/testsuite/g++.dg/musttail6.C        | 60 ---------------------------------
 gcc/testsuite/g++.dg/musttail9.C        | 10 ------
 gcc/testsuite/lib/target-supports.exp   |  9 -----
 14 files changed, 324 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/musttail1.c 
b/gcc/testsuite/c-c++-common/musttail1.c
deleted file mode 100644
index 74efcc2a0bc6..000000000000
--- a/gcc/testsuite/c-c++-common/musttail1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-int __attribute__((noinline,noclone,noipa))
-callee (int i)
-{
-  return i * i;
-}
-
-int __attribute__((noinline,noclone,noipa))
-caller (int i)
-{
-  [[gnu::musttail]] return callee (i + 1);
-}
diff --git a/gcc/testsuite/c-c++-common/musttail12.c 
b/gcc/testsuite/c-c++-common/musttail12.c
deleted file mode 100644
index 4140bcd00950..000000000000
--- a/gcc/testsuite/c-c++-common/musttail12.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* { dg-do compile { target { struct_tail_call && { c || c++11 } } } } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-struct str
-{
-  int a, b;
-};
-struct str
-cstruct (int x)
-{
-  if (x < 10)
-    L:
-    [[gnu::musttail]] return cstruct (x + 1);
-  return ((struct str){ x, 0 });
-}
diff --git a/gcc/testsuite/c-c++-common/musttail13.c 
b/gcc/testsuite/c-c++-common/musttail13.c
deleted file mode 100644
index 6bd212fbeb8f..000000000000
--- a/gcc/testsuite/c-c++-common/musttail13.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* { dg-do compile { target { c || c++11 } } } */
-void f(void)
-{
-  [[gnu::musttail]] return; /* { dg-error "cannot tail-call.*return value must 
be a call" } */
-}
diff --git a/gcc/testsuite/c-c++-common/musttail2.c 
b/gcc/testsuite/c-c++-common/musttail2.c
deleted file mode 100644
index 86f2c3d77404..000000000000
--- a/gcc/testsuite/c-c++-common/musttail2.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-
-struct box { char field[256]; int i; };
-
-int __attribute__((noinline,noclone,noipa))
-test_2_callee (int i, struct box b)
-{
-  if (b.field[0])
-    return 5;
-  return i * i;
-}
-
-int __attribute__((noinline,noclone,noipa))
-test_2_caller (int i)
-{
-  struct box b;
-  [[gnu::musttail]] return test_2_callee (i + 1, b); /* { dg-error "cannot 
tail-call: " } */
-}
-
-extern void setjmp (void);
-void
-test_3 (void)
-{
-  [[gnu::musttail]] return setjmp (); /* { dg-error "cannot tail-call: " } */
-}
-
-extern float f7(void);
-
-int
-test_6 (void)
-{
-  [[gnu::musttail]] return f7(); /* { dg-error "cannot tail-call: " } */
-}
diff --git a/gcc/testsuite/c-c++-common/musttail3.c 
b/gcc/testsuite/c-c++-common/musttail3.c
deleted file mode 100644
index ea9589c59ef2..000000000000
--- a/gcc/testsuite/c-c++-common/musttail3.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-
-extern int foo2 (int x, ...);
-
-struct str
-{
-  int a, b;
-};
-
-struct str
-cstruct (int x)
-{
-  if (x < 10)
-    [[clang::musttail]] return cstruct (x + 1);
-  return ((struct str){ x, 0 });
-}
-
-int
-foo (int x)
-{
-  if (x < 10)
-    [[clang::musttail]] return foo2 (x, 29);
-  if (x < 100)
-    {
-      int k = foo (x + 1);
-      [[clang::musttail]] return k;    /* { dg-error "cannot tail-call: " } */
-    }
-  return x;
-}
diff --git a/gcc/testsuite/c-c++-common/musttail4.c 
b/gcc/testsuite/c-c++-common/musttail4.c
deleted file mode 100644
index 23f4b5e1cd68..000000000000
--- a/gcc/testsuite/c-c++-common/musttail4.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-
-struct box { char field[64]; int i; };
-
-struct box __attribute__((noinline,noclone,noipa))
-returns_struct (int i)
-{
-  struct box b;
-  b.i = i * i;
-  return b;
-}
-
-int __attribute__((noinline,noclone))
-test_1 (int i)
-{
-  [[gnu::musttail]] return returns_struct (i * 5).i; /* { dg-error "cannot 
tail-call: " } */
-}
diff --git a/gcc/testsuite/c-c++-common/musttail5.c 
b/gcc/testsuite/c-c++-common/musttail5.c
deleted file mode 100644
index 234da0d3f2a9..000000000000
--- a/gcc/testsuite/c-c++-common/musttail5.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-std=c23" { target c } } */
-/* { dg-options "-std=gnu++11" { target c++ } } */
-
-[[musttail]] int j; /* { dg-warning "attribute" } */
-__attribute__((musttail)) int k; /* { dg-warning "attribute" } */
-
-void foo(void)
-{
-  [[gnu::musttail]] j++; /* { dg-warning "attribute" } */
-  [[gnu::musttail]] if (k > 0) /* { dg-warning "attribute" } */
-    [[gnu::musttail]] k++; /* { dg-warning "attribute" } */
-}
-
-int foo2(int p)
-{
-  [[gnu::musttail(1)]] return foo2(p + 1); /* { dg-error "\(before numeric 
constant|attribute\)" } */
-}
-
-int i;
-
-int foo3(void)
-{
-  [[musttail]] i++; /* { dg-warning "attribute" } */
-  [[musttail]] if (i > 10) /* { dg-warning "attribute" } */
-    [[musttail]] return foo2(i); /* { dg-warning "attribute" } */
-  return 0;
-}
diff --git a/gcc/testsuite/c-c++-common/musttail7.c 
b/gcc/testsuite/c-c++-common/musttail7.c
deleted file mode 100644
index c753a3fe9b2a..000000000000
--- a/gcc/testsuite/c-c++-common/musttail7.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-void __attribute__((noipa)) f() {}
-
-void f2()
-{
-  [[gnu::musttail]] return f2();
-}
-
-void f3()
-{
-  [[gnu::musttail]] return f();
-}
diff --git a/gcc/testsuite/c-c++-common/musttail8.c 
b/gcc/testsuite/c-c++-common/musttail8.c
deleted file mode 100644
index 9fa10e0b54c4..000000000000
--- a/gcc/testsuite/c-c++-common/musttail8.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* { dg-do compile { target { tail_call && { c || c++11 } } } } */
-
-float f1(void);
-
-int f2(void)
-{
-  [[gnu::musttail]] return f1 (); /* { dg-error "changed after call" } */
-}
-
-
-int f3(int *);
-
-int f4(void)
-{
-  int x;
-  [[gnu::musttail]] return f3(&x); /* { dg-error "\(refers to locals|other 
reasons\)" } */
-}
diff --git a/gcc/testsuite/g++.dg/musttail10.C 
b/gcc/testsuite/g++.dg/musttail10.C
deleted file mode 100644
index ff7fcc7d8755..000000000000
--- a/gcc/testsuite/g++.dg/musttail10.C
+++ /dev/null
@@ -1,40 +0,0 @@
-/* { dg-do compile { target { tail_call } } } */
-/* { dg-options "-std=gnu++11" } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-template <class T> T f();
-
-double g() { [[gnu::musttail]] return f<int>(); } /* { dg-error "cannot 
tail-call" } */
-
-template <class T>
-__attribute__((noinline, noclone, noipa))
-T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" 
"" { target powerpc*-*-* } } */
-
-template <class T>
-__attribute__((noinline, noclone, noipa))
-T g2() { [[gnu::musttail]] return f<T>(); }
-
-template <class T>
-__attribute__((noinline, noclone, noipa))
-/* Would work with -O1.  */
-T g3() { [[gnu::musttail]] return f<T>(); } /* { dg-error "cannot tail-call" } 
*/
-
-template <class T>
-__attribute__((noinline, noclone, noipa))
-T g4() { [[gnu::musttail]] return f<double>(); } /* { dg-error "cannot 
tail-call" } */
-
-class C
-{
-  double x;
-public:
-  C(double x) : x(x) {}
-  ~C() { asm("":::"memory"); }
-};
-
-int main()
-{
-  g1<int>();
-  g2<double>();
-  g3<C>();
-  g4<int>();
-}
diff --git a/gcc/testsuite/g++.dg/musttail11.C 
b/gcc/testsuite/g++.dg/musttail11.C
deleted file mode 100644
index 1779e3287a93..000000000000
--- a/gcc/testsuite/g++.dg/musttail11.C
+++ /dev/null
@@ -1,33 +0,0 @@
-/* { dg-do compile { target { tail_call } } } */
-/* { dg-options "-std=gnu++11" } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-template <class T> T f();
-
-class C
-{
-  double x;
-public:
-  C(double x) : x(x) {}
-  ~C() { asm("":::"memory"); }
-  operator int() { return x; }
-};
-
-template <class T>
-__attribute__((noinline, noclone, noipa))
-T g5() { [[gnu::musttail]] return f<C> (); } /* { dg-error "cannot tail-call" 
} */
-
-C h();
-
-__attribute__((noinline, noclone, noipa))
-int g6() { [[gnu::musttail]] return h (); }  /* { dg-error "cannot tail-call" 
} */
-
-__attribute__((noinline, noclone, noipa))
-C g7() { [[gnu::musttail]] return h (); } /* { dg-error "cannot tail-call" } */
-
-int main()
-{
-  g5<int> ();
-  g6 ();
-  g7 ();
-}
diff --git a/gcc/testsuite/g++.dg/musttail6.C b/gcc/testsuite/g++.dg/musttail6.C
deleted file mode 100644
index 434a54a441c8..000000000000
--- a/gcc/testsuite/g++.dg/musttail6.C
+++ /dev/null
@@ -1,60 +0,0 @@
-/* { dg-do compile { target { struct_tail_call } } } */
-/* A lot of architectures will not run this due to PR115606 and PR115607 */
-/* { dg-skip-if "powerpc does not support sibcall to templates" { powerpc*-*-* 
} } */
-/* { dg-options "-std=gnu++11" } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-class Foo {
-public:
-  int a, b;
-  Foo(int a, int b) : a(a), b(b) {}
-};
-
-Foo __attribute__((noinline,noclone,noipa))
-callee (int i)
-{
-  return Foo(i, i+1);
-}
-
-Foo __attribute__((noinline,noclone,noipa))
-caller (int i)
-{
-  [[gnu::musttail]] return callee (i + 1);
-}
-
-template<typename T>
-T __attribute__((noinline,noclone,noipa)) foo (T i)
-{
-  return i + 1;
-}
-
-int
-caller2 (int k)
-{
-  [[gnu::musttail]] return foo<int>(1);
-}
-
-template<typename T>
-T caller3 (T v)
-{
-  [[gnu::musttail]] return foo<T>(v);
-}
-
-int call3(int i)
-{
-  [[gnu::musttail]] return caller3<int>(i + 1);
-}
-
-struct Bar {
-  int a;
-  Bar(int a) : a(a) {}
-  Bar operator+(Bar o) { return Bar(a + o.a); }
-};
-
-#if __OPTIMIZE__ >= 1
-Bar
-caller4 (Bar k)
-{
-  [[gnu::musttail]] return caller3<Bar>(Bar(99));
-}
-#endif
diff --git a/gcc/testsuite/g++.dg/musttail9.C b/gcc/testsuite/g++.dg/musttail9.C
deleted file mode 100644
index fb0262e751be..000000000000
--- a/gcc/testsuite/g++.dg/musttail9.C
+++ /dev/null
@@ -1,10 +0,0 @@
-/* { dg-do compile { target { tail_call } } } */
-/* { dg-options "-std=gnu++11" } */
-/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
-
-extern void foo();
-
-void f() noexcept
-{
-  [[gnu::musttail]] return foo(); /* { dg-error "call may throw exception that 
does not propagate" } */
-}
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 37188880f6c2..daa0c75d2bc3 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -12744,15 +12744,6 @@ proc check_effective_target_tail_call { } {
     } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed 
dump.
 }
 
-# Return 1 if the target can perform tail-call optimizations for structures
-proc check_effective_target_struct_tail_call { } {
-    return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
-       struct foo { int a, b };
-       __attribute__((__noipa__)) struct foo foo (void) { return {}; }
-       __attribute__((__noipa__)) struct foo bar (void) { return foo(); }
-    } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed 
dump.
-}
-
 # Return 1 if the target's calling sequence or its ABI
 # create implicit stack probes at or prior to function entry.
 proc check_effective_target_caller_implicit_probes { } {

Reply via email to