public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>, Michael Matz <matz@suse.de>
Cc: Peter Bergner <bergner@vnet.ibm.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA][PATCH][PR middle-end/61118] Improve tree CFG accuracy for setjmp/longjmp
Date: Fri, 09 Mar 2018 19:42:00 -0000	[thread overview]
Message-ID: <5eb3c45e-3bbc-d48a-9e1f-fbfcf69aa316@redhat.com> (raw)
In-Reply-To: <CAFiYyc3AEGdNpEOs6F-mE4FuoWqPNq3NXhyF3BzOvWV9e1h7Sw@mail.gmail.com>

On 03/08/2018 06:22 AM, Richard Biener wrote:
> On Thu, Mar 8, 2018 at 1:54 PM, Michael Matz <matz@suse.de> wrote:
>> Hi,
>>
>> On Wed, 7 Mar 2018, Peter Bergner wrote:
>>
>>> On 3/7/18 12:01 AM, Jeff Law wrote:
>>>> I believe so by nature that the setjmp dominates the longjmp sites and
>>>> thus also dominates the dispatcher.  But it's something I want to
>>>> explicitly check before resubmitting.
>>>
>>> Are we sure a setjmp has to dominate its longjmp sites?
>>
>> No, they don't have to dominate.  For lack of better term I used something
>> like "ordered after" in my mails :)
>>
>>> Couldn't you have something like:
>>
>> Yeah, exactly.
> 
> So given all the discussion _iff_ we want to change the CFG we generate then
> let's invent a general __builtin_receiver () and lower setjmp to
And I'm seriously thinking we may want to hold off on the fix for 61118
for gcc-8.  We still might want to fix 21161 though.  I still need to
digest all the discussion.


> 
>   setjmp ();
>   res = __builtin_receiver ();
> 
> and construct a CFG around that.  Remember that IIRC I added the abnormal
> edges to and from setjmp to inhibit code-motion across it so whatever CFG
> we'll end up with should ensure that there can't be any code-motion optimization
> across the above pair nor "inbetween" it.  The straight-forward
> CFG of, apart from the fallthru from setjmp to the receiver, a abnormal edge
> to the dispatcher from setjmp and an abnormal edge from the dispatcher to
> the receiver would do that trick I think.
> 
> I'd rather not do that for GCC 8 though.  So to fix the warning can't we do
> sth else "good" and move the strange warning code from RTL to GIMPLE?
Someone mentioned that possibility in one of the related BZs.  The
concern was the factoring of the handler could really hinder good
dataflow analysis.  We could end up making things worse :(


> 
> Or re-do the warning?  Since in the other thread about setjmp side-effects
> we concluded that setjmp has to preserve all call-saved regs?  I don't see
> that reflected in regno_clobbered_at_setjmp or its caller -- that is,
> we should only warn for call clobbered and thus caller-saved regs because
> normal return may clobber the spilled values.
Possibly.  It's clear from the discussion and multitude of BZs that this
is complex and easily goof'd.

I believe part of the "trick" here is that once we compute (in RTL) the
set of objects live across the setjmp the allocators then refuse to
allocate those values into call-saved registers (hence the other
discussion thread) with Peter and co.  Of course the RTL analysis get
this wrong in a roughly similar manner (21161).


> Not sure if the PR testcase is amongst the cases fixed by such change.
Unclear -- it'd likely depend on where we do the analysis.  It's
certainly the case that for 61118 that if the analysis happens in RTL
and we haven't addressed our CFG correctness issues that we're going to
fail.

jeff.

  parent reply	other threads:[~2018-03-09 19:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28  0:16 Jeff Law
2018-02-28 10:43 ` Richard Biener
2018-02-28 10:48   ` Richard Biener
2018-02-28 15:46     ` Jeff Law
2018-02-28 17:35   ` Jeff Law
2018-03-01 10:45     ` Richard Biener
2018-03-05 18:30     ` Michael Matz
2018-03-05 19:08       ` Jeff Law
2018-03-05 19:30         ` Michael Matz
2018-03-06  3:41           ` Jeff Law
2018-03-06  8:57             ` Richard Biener
2018-03-07  6:01               ` Jeff Law
2018-03-08  0:04                 ` Peter Bergner
2018-03-08 12:54                   ` Michael Matz
2018-03-08 13:22                     ` Richard Biener
2018-03-08 13:26                       ` Richard Biener
2018-03-08 13:28                       ` Michael Matz
2018-03-09 19:42                       ` Jeff Law [this message]
2018-03-09 20:20                         ` Richard Biener
2018-03-09 19:45                   ` Jeff Law
2018-03-06 14:17             ` Michael Matz
2018-03-06 14:43               ` Richard Biener
2018-03-06 16:31                 ` Michael Matz
2018-03-02 22:18   ` Jeff Law
2018-03-02 23:07     ` Jakub Jelinek
2018-03-02 23:17       ` Jeff Law
2018-03-05 14:07     ` 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=5eb3c45e-3bbc-d48a-9e1f-fbfcf69aa316@redhat.com \
    --to=law@redhat.com \
    --cc=bergner@vnet.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.de \
    --cc=richard.guenther@gmail.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).