From: Aldy Hernandez <aldyh@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <jeffreyalaw@gmail.com>, GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Remove can_throw_non_call_exceptions special case from operator_div::wi_fold.
Date: Tue, 30 Nov 2021 10:04:16 +0100 [thread overview]
Message-ID: <CAGm3qMU9w0zqe9Jt_7B4Nx4een--5KT1mUX+pCR=Gpao6=RZGA@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc2jCvKvBfuarEPsphEOmQ3NPRt=_xMLD8FB0rW+Dk0Avw@mail.gmail.com>
Will adjust, re-test and commit.
Thanks.
Aldy
On Tue, Nov 30, 2021 at 10:00 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Tue, Nov 30, 2021 at 9:51 AM Aldy Hernandez <aldyh@redhat.com> wrote:
> >
> > On Tue, Nov 30, 2021 at 8:37 AM Richard Biener
> > <richard.guenther@gmail.com> wrote:
> > >
> > > On Mon, Nov 29, 2021 at 4:24 PM Aldy Hernandez <aldyh@redhat.com> wrote:
> > > >
> > > > On Mon, Nov 29, 2021 at 3:48 PM Richard Biener
> > > > <richard.guenther@gmail.com> wrote:
> > > > >
> > > > > On Mon, Nov 29, 2021 at 3:39 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 11/29/2021 7:00 AM, Aldy Hernandez via Gcc-patches wrote:
> > > > > > > As discussed in the PR. The code makes no difference, so whatever test
> > > > > > > we added this special case for has been fixed or is being papered over.
> > > > > > > I think we should fix any fall out upstream.
> > > > > > >
> > > > > > > [Unless Andrew can remember why we added this and it still applies.]
> > > > > > >
> > > > > > > Tested on x86-64 Linux.
> > > > > > >
> > > > > > > OK for trunk?
> > > > > > >
> > > > > > > PR 103451
> > > > > > >
> > > > > > > gcc/ChangeLog:
> > > > > > >
> > > > > > > * range-op.cc (operator_div::wi_fold): Remove
> > > > > > > can_throw_non_call_exceptions special case.
> > > > > > >
> > > > > > > gcc/testsuite/ChangeLog:
> > > > > > >
> > > > > > > * gcc.dg/pr103451.c: New test.
> > > > > > I'll defer to Andrew, but it seems wrong to me. The whole point is to
> > > > > > set the result to varying so that we don't know the result and never
> > > > > > remove the division which is critical for -fnon-call-exceptions.
> > > > >
> > > > > But that has nothing to do with computing the value range for
> > > > > the result which is only accessible when the stmt does _not_ throw ...
> > > > >
> > > > > That is, if we compute non-VARYING here and because of that
> > > > > remove the stmt then _that's_ the place to fix (IMO)
> > > >
> > > > Ughh, I think you're both right.
> > > >
> > > > We should fix this upstream AND we should test for the presence of the
> > > > division by 0 in the optimized dump.
> > > >
> > > > Of course doing both opens a can of worms. The division by zero can
> > > > be cleaned up by (at least) DCE, DSE, and the code sinking passes.
> > > > I've fixed all 3 in the attached (untested) patch. Dunno what y'all
> > > > want to do at this point.
> > >
> > > I think you need to add -fno-delete-dead-exceptions to the testcase.
> > > The sinking
> > > bug looks real, but just
> > >
> > > && (cfun->can_delete_dead_exceptions
> > > || !stmt_could_throw_p (cfun, stmt))
> > >
> > > is needed there. That change is OK.
> >
> > Did you mean the entire patch (as attached) is OK, or just the sink part?
>
> The DCE and DSE parts are wrong and not needed. The remaining pieces
> are OK.
>
> Thanks,
> Richard.
>
> > Thanks.
> > Aldy
>
prev parent reply other threads:[~2021-11-30 9:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 14:00 Aldy Hernandez
2021-11-29 14:39 ` Jeff Law
2021-11-29 14:48 ` Richard Biener
2021-11-29 15:24 ` Aldy Hernandez
2021-11-30 7:37 ` Richard Biener
2021-11-30 8:51 ` Aldy Hernandez
2021-11-30 9:00 ` Richard Biener
2021-11-30 9:04 ` Aldy Hernandez [this message]
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='CAGm3qMU9w0zqe9Jt_7B4Nx4een--5KT1mUX+pCR=Gpao6=RZGA@mail.gmail.com' \
--to=aldyh@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--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).