public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6151] Revert "tree-optimization/108691 - indirect calls to setjmp"
@ 2023-02-21  9:26 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-02-21  9:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:19ec4092a74821055d3bd61023b3bc2bd1ec4f10

commit r13-6151-g19ec4092a74821055d3bd61023b3bc2bd1ec4f10
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Feb 21 10:26:30 2023 +0100

    Revert "tree-optimization/108691 - indirect calls to setjmp"
    
    This reverts commit 6436add49ed9ecf74f1f01b4fe18961df4f3e83d.

Diff:
---
 gcc/calls.cc                    | 10 +++++-----
 gcc/cfgexpand.cc                |  7 -------
 gcc/testsuite/gcc.dg/pr108691.c |  9 ---------
 gcc/tree-cfg.cc                 |  4 +---
 4 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/gcc/calls.cc b/gcc/calls.cc
index 0242d52cfb3..4d7f6c3d291 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -506,11 +506,11 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
   if (ecf_flags & ECF_NORETURN)
     add_reg_note (call_insn, REG_NORETURN, const0_rtx);
 
-  if (ecf_flags & ECF_RETURNS_TWICE
-      /* We rely on GIMPLE setting this flag and here use it to
-	 catch formerly indirect and not control-altering calls.  */
-      && cfun->calls_setjmp)
-    add_reg_note (call_insn, REG_SETJMP, const0_rtx);
+  if (ecf_flags & ECF_RETURNS_TWICE)
+    {
+      add_reg_note (call_insn, REG_SETJMP, const0_rtx);
+      cfun->calls_setjmp = 1;
+    }
 
   SIBLING_CALL_P (call_insn) = ((ecf_flags & ECF_SIBCALL) != 0);
 
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index ab143a6d2d3..25b1558dcb9 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -2808,11 +2808,6 @@ expand_call_stmt (gcall *stmt)
   /* Must come after copying location.  */
   copy_warning (exp, stmt);
 
-  /* For calls that do not alter control flow avoid REG_SETJMP notes.  */
-  bool saved_calls_setjmp = cfun->calls_setjmp;
-  if (!gimple_call_ctrl_altering_p (stmt))
-    cfun->calls_setjmp = false;
-
   /* Ensure RTL is created for debug args.  */
   if (decl && DECL_HAS_DEBUG_ARGS_P (decl))
     {
@@ -2851,8 +2846,6 @@ expand_call_stmt (gcall *stmt)
     }
 
   mark_transaction_restart_calls (stmt);
-
-  cfun->calls_setjmp = saved_calls_setjmp;
 }
 
 
diff --git a/gcc/testsuite/gcc.dg/pr108691.c b/gcc/testsuite/gcc.dg/pr108691.c
deleted file mode 100644
index e412df10f22..00000000000
--- a/gcc/testsuite/gcc.dg/pr108691.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-extern int __attribute__((returns_twice)) setjmp(void*);
-
-void bbb(void) {
-  int (*fnptr)(void*) = setjmp;
-  fnptr(0);
-}
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index e23293e5cd1..a9fcc7fd050 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -2280,9 +2280,7 @@ notice_special_calls (gcall *call)
 
   if (flags & ECF_MAY_BE_ALLOCA)
     cfun->calls_alloca = true;
-  if (flags & ECF_RETURNS_TWICE
-      && (!(cfun->curr_properties & PROP_cfg)
-	  || gimple_call_ctrl_altering_p (call)))
+  if (flags & ECF_RETURNS_TWICE)
     cfun->calls_setjmp = true;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-21  9:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21  9:26 [gcc r13-6151] Revert "tree-optimization/108691 - indirect calls to setjmp" Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).