public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>, Jeff Law <jeffreyalaw@gmail.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>, Martin Sebor <msebor@redhat.com>
Subject: Re: [PATCH] Try to resolve paths in threader without looking further back.
Date: Thu, 21 Oct 2021 08:50:57 -0600	[thread overview]
Message-ID: <c84ffc41-7dd5-fc26-cddb-6c302465a17b@gmail.com> (raw)
In-Reply-To: <CAGm3qMWzQZFAQuxO4_SKArHFeQBveo3bydafiPZVC5a1UmCfdg@mail.gmail.com>

On 10/21/21 1:17 AM, Aldy Hernandez wrote:
> On Wed, Oct 20, 2021 at 10:01 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>>
>>
>>
>> On 10/20/2021 9:15 AM, Aldy Hernandez wrote:
>>> On Wed, Oct 20, 2021 at 4:35 PM Martin Sebor <msebor@gmail.com> wrote:
>>>
>>>> I appreciate the heads up.  I'm happy that the threader has
>>>> improved.  I'm obviously not pleased that it has led to regressions
>>>> in warnings but I understand that in some cases they might be due
>>>> to limitations in the warning code.  I think the test case you have
>>>> xfailed might be one such example.  The uninitialized warnings are
>>>> exquisitely sensitive to these types of changes.  If/when this patch
>>>> is applied please reopen PR 89230 and reference this commit.
>>>>
>>>> Having said that, to maintain the quality of diagnostics,
>>>> the work that goes into these nice optimizer improvements needs
>>>> to be balanced by an effort to either update the warning code
>>>> to cope with the IL changes, or the optimizers need to take care
>>>> to avoid exposing undefined code that the warnings are designed
>>>> to detect.  I'm concerned not just that the quality of GCC 12
>>>> diagnostics has been eroding, but also that it seems to be not
>>>> just acceptable but expected.
>>> You make a very good point.  It is certainly not my intention to make
>>> life difficult for the warning maintainers, but I'm afraid I don't
>>> have sufficient knowledge in the area to improve them.
>>>
>>> There may be some low hanging fruit though.  At least in the warnings
>>> that use the ranger, there's no reason to run these passes so late in
>>> the pipeline.  You could run the warning code as early as you want,
>>> insofar as SSA is available and the CFG has been built.  Heck, you may
>>> even be able to run at -O0, though we may need some sort of value
>>> numbering.  I believe Richi even suggested this a while back.
>> Running them later in the pipeline is to take advantage of the
>> optimizers removing dead and unreachable code as much as possible. In
>> fact, that's critical to -Wuninitialized.  Optimizing away unreachable
>> paths  to avoid Wuninitialized false positives has been the major driver
>> of jump threading improvements for the last 15 years.
> 
> Ughh, that's unfortunate.  We're gonna have to come up with
> improvements to the Wuninitialized code, or a different paradigm
> altogether.  I'm afraid this will only get worse.
> 
> It is a bit ironic that jump threading helps reduce Wuninitialized
> false positives, but yet too much of it causes even more false
> positives.

For best results they need to work together.  That was also my
point.  All middle end warnings necessarily rely on optimizers
for one thing or another.  When we change one such optimization
and break the assumptions the warnings make (right or wrong),
the warnings break too.  To minimize the fallout we need to
do two things: decouple them as much as possible (minimize
the assumptions) and, when we change the optimizers, we
might need to update the warnings.  If we don't, then yes,
things are going to keep getting worse.

As an aside, in GCC 12 a good number of middle end warnings
already do run at -O0: all those in gimple-ssa-warn-access.c.
I'd like to see gimple-ssa-array-bounds invoked from the access
pass too (instead of from VRP), and eventually -Wrestrict as well.
I'm not sure about the strlen/sprintf warnings; those might need
to stay where they are because they run as part of the optimizers
there.

(By the way, I don't see range info in the access pass at -O0.
Should I?)

Martin

  reply	other threads:[~2021-10-21 14:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 10:28 Aldy Hernandez
2021-10-20 14:35 ` Martin Sebor
2021-10-20 15:15   ` Aldy Hernandez
2021-10-20 20:01     ` Jeff Law
2021-10-21  7:17       ` Aldy Hernandez
2021-10-21 14:50         ` Martin Sebor [this message]
2021-10-22 11:22           ` Aldy Hernandez
2021-10-22 14:27             ` Martin Sebor
2021-10-22 15:18               ` Aldy Hernandez
2021-10-22 15:59                 ` Martin Sebor
2021-10-23  8:31                   ` Aldy Hernandez
2021-10-21 17:59         ` Jeff Law
2021-10-21  7:22       ` Richard Biener
2021-10-20 20:19 ` Jeff Law
2021-10-21 10:15   ` Aldy Hernandez
2021-10-22  3:34     ` Jeff Law
2021-10-22  3:53       ` Aldy Hernandez
2021-10-24 16:57         ` Jeff Law
2021-10-24 17:55           ` Bernhard Reutner-Fischer
2021-10-24 18:21           ` Richard Biener
2021-10-24 18:25           ` Aldy Hernandez
2021-10-25  6:47             ` Aldy Hernandez
2021-10-25 18:42             ` Jeff Law
2021-10-25 18:49               ` Aldy Hernandez
2021-10-25 18:58                 ` Jeff Law
2021-10-25 16:58 ` Andrew MacLeod
2021-10-25 17:01   ` Aldy Hernandez
2021-10-25 17:02   ` Jeff Law

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=c84ffc41-7dd5-fc26-cddb-6c302465a17b@gmail.com \
    --to=msebor@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=msebor@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).