public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: segher@kernel.crashing.org, jeffreyalaw@gmail.com
Subject: [PATCH] rtl-optimization/106082 - preserve EH note for no non-local goto
Date: Tue, 28 Jun 2022 11:11:55 +0000 (UTC)	[thread overview]
Message-ID: <20220628111155.6efQWrtaQguZUZa7eebtthWCur0HZCyLmpE0Y5QPAhg@z> (raw)

The following makes sure we preserve EH notes on call insns that
indicate the call doesn't perform a non-local goto when distributing
notes after combining insns.

Bootstrap & regtest pending on x86_64-unknown-linux-gnu, tested on
the m68k testcase in the PR.

OK for trunk if testing passes?

Thanks,
Richard.

2022-06-28  Richard Biener  <rguenther@suse.de>

	PR rtl-optimization/106082
	* combine.cc (distribute_notes): Preserve notes when
	they indicate a call doesn't perform a non-local goto.
---
 gcc/combine.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/combine.cc b/gcc/combine.cc
index a8305273e44..3d34e860cf9 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -14218,8 +14218,10 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 	      gcc_assert (from_insn == i3);
 	    /* We are making sure there is a single effective REG_EH_REGION
 	       note and it's valid to put it on i3.  */
-	    if (!insn_could_throw_p (from_insn))
-	      /* Throw away stra notes on insns that can never throw.  */
+	    if (!insn_could_throw_p (from_insn)
+		&& (lp_nr != INT_MIN || !can_nonlocal_goto (from_insn)))
+	      /* Throw away stray notes on insns that can never throw or
+		 make a nonlocal goto.  */
 	      ;
 	    else
 	      {
-- 
2.35.3

             reply	other threads:[~2022-06-28 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 11:11 Richard Biener [this message]
     [not found] <202206281111.25SBBvhG030417@gate.crashing.org>
2022-06-28 17:00 ` Segher Boessenkool
     [not found] <62bae1fb.1c69fb81.b56b8.ca78SMTPIN_ADDED_MISSING@mx.google.com>
2022-06-28 16:09 ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2022-06-28 11:11 Richard Biener
2022-06-28 11:11 Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220628111155.6efQWrtaQguZUZa7eebtthWCur0HZCyLmpE0Y5QPAhg@z \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).