public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104288] [11/12 Regression] EVRP null pointer check removal for strcmp (and maybe others) is not flow senative
Date: Tue, 01 Feb 2022 08:04:16 +0000	[thread overview]
Message-ID: <bug-104288-4-AIXnon8JUh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104288-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 31 Jan 2022, amacleod at redhat dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104288
> 
> --- Comment #7 from Andrew Macleod <amacleod at redhat dot com> ---
> I'm contemplating the situation.  The trick is to find something with minimal
> change that is functionally acceptable.   I think the goal for this release
> would be to continue to get vrp111.c, and simply not get it in the problematic
> case..  ie, if the first use in the block is unknown and then LATER in the
> block we figure out that it is non-null, we will miss that case through-out 
> the block for now.  
> 
> Effectively: if no dominator block contains non-null then whatever the first
> use in a block determines will apply to the whole block, for the duration of
> the block.. but upon exit to the block, if it was non-null anywhere, then all
> following blocks get that knowledge.  
> 
> I think this could be done reasonably efficiently with a minimum of risk/churn.
>  At least that is what I'M currently trying.  would this be OK?

Let's see what you can come up with.

For ranges derived from stmts that are not the last in a BB (in which case
they apply to outgoing edges) you have to strictly adhere to the notion
that you have ranges incoming into a stmt and ranges outgoing so each
stmt is the source of new ranges.  That applies to divisions
(nonzero divisor) or shifts (no out of range shift operand).  But you
may not apply the range to all stmts of a block (including the stmt
producing the range itself).  With the old EVRP scheme I failed to
nicely support deriving non-zero divisor ranges for this reason for
example.

That makes it complicated to handle in an on-demand fashion of course
since you'd need a per stmt cache that is much more difficult to manage
and look up.

(which is why I really did like to have the old EVRP since conceptually
it's easy to have a very fine-grained "context")

Practically I think it's OK for true on-demand users to have the
less precise per-BB non-NULL data.  But the value-range passes
should really be able to keep a precise per-stmt "context".

Did I say I liked the old EVRP way of doing things? ;)

  parent reply	other threads:[~2022-02-01  8:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 10:09 [Bug c/104288] New: Null pointer check invalidly deleted nrk at disroot dot org
2022-01-30 10:26 ` [Bug middle-end/104288] [11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-30 10:29 ` [Bug tree-optimization/104288] [11/12 Regression] EVRP null pointer check removal for strcmp (and maybe others) is not flow senative pinskia at gcc dot gnu.org
2022-01-30 11:03 ` jakub at gcc dot gnu.org
2022-01-31  8:21 ` rguenth at gcc dot gnu.org
2022-01-31 14:53 ` amacleod at redhat dot com
2022-01-31 15:34 ` jakub at gcc dot gnu.org
2022-01-31 22:39 ` amacleod at redhat dot com
2022-02-01  8:04 ` rguenther at suse dot de [this message]
2022-02-02 21:52 ` amacleod at redhat dot com
2022-02-08 15:03 ` cvs-commit at gcc dot gnu.org
2022-02-09 14:10 ` cvs-commit at gcc dot gnu.org
2022-02-09 14:11 ` amacleod at redhat dot com
2023-04-09  3:59 ` christian.prochaska@genode-labs.com
2023-04-09  4:12 ` pinskia at gcc dot gnu.org
2023-04-09  4:12 ` pinskia at gcc dot gnu.org
2023-04-09  7:07 ` christian.prochaska@genode-labs.com
2023-04-09  7:43 ` pinskia at gcc dot gnu.org

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=bug-104288-4-AIXnon8JUh@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).