public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org, rth@redhat.com, ebotcazou@adacore.com,
	jason@redhat.com
Subject: Re: [PATCH][v2] rtl-optimization/105231 - distribute_notes and REG_EH_REGION
Date: Tue, 19 Apr 2022 07:29:07 -0500	[thread overview]
Message-ID: <20220419122907.GG25951@gate.crashing.org> (raw)
In-Reply-To: <20220419110209.A4C1F139BE@imap2.suse-dmz.suse.de>

Hi!

So the assert last week was for a landing pad <= 0?  < or =?

On Tue, Apr 19, 2022 at 01:02:09PM +0200, Richard Biener wrote:
> The following mitigates a problem in combine distribute_notes which
> places an original REG_EH_REGION based on only may_trap_p which is
> good to test whether a non-call insn can possibly throw but not if
> actually it does or we care.  That's something we decided at RTL
> expansion time where we possibly still know the insn evaluates
> to a constant.
> 
> In fact, the REG_EH_REGION can only come from the original i3 and
> an assert is added to that effect.  That means we only need to
> retain the note on i3 or, if that cannot trap, drop it but we
> should never move it to i2.  If splitting of i3 ever becomes a
> problem here the insn split should be rejected instead.
> 
> We are also considering all REG_EH_REGION equal, including
> must-not-throw and nothrow kinds but when those are not from i3
> we have no good idea what should happen to them, so the following
> simply drops them.

And that always is safe?  Why do we have REG_EH_REGION for those cases
at all, then?

> +	  {
> +	    int lp_nr = INTVAL (XEXP (note, 0));
> +	    /* A REG_EH_REGION note transfering control can only ever come
> +	       from i3.  */
> +	    gcc_assert (lp_nr <= 0 || from_insn == i3);

	    if (lp_nr > 0)
	      gcc_assert (from_insn == i3);
is less obfuscated ;-)

> +	    /* For nothrow (lp_nr == 0 or lp_nr == INT_MIN) and
> +	       for insns in a MUST_NOT_THROW region (lp_nr < 0)
> +	       it's difficult to decide what to do for notes
> +	       coming from an insn that is not i3.  Just drop
> +	       those.  */

That sounds like we do not know what is correct to do, so just sweep it
under the carpet and hope it works out.  "Just drop those, that is
always safe"?  (Is it always safe?)

Okay for trunk with maybe a word or two more there.  Thanks!


Segher

  reply	other threads:[~2022-04-19 12:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 11:02 Richard Biener
2022-04-19 12:29 ` Segher Boessenkool [this message]
2022-04-19 12:58   ` Richard Biener
2022-04-19 13:19     ` Segher Boessenkool
2022-04-19 15:00       ` Richard Biener
2022-04-19 16:10         ` Segher Boessenkool

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=20220419122907.GG25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=rguenther@suse.de \
    --cc=rth@redhat.com \
    /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).