public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/93917] VRP forgets range of value read from memory
Date: Thu, 19 Nov 2020 23:20:25 +0000	[thread overview]
Message-ID: <bug-93917-4-ORLPMB7Ien@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93917-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Macleod <amacleod at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
This seems to be a good place to bring up a question I have.

What exactly do we want to with __builtin_unreachable across passes?

Ranger was initially starting with the previously set globally known value, and
I had to disable it for pr61034.C

Basically, the routine was pre-optimized and inlined, and inlining sets the
global range based on the output from the optimizations, and when ranger
removed the code with the unreachable in it, the testcase failed.

so 
void f(int n){
  if(n<0)__builtin_unreachable();
}
n has a global range of [0, +INF]

Is that the basic point of this?  Can we set the global range to that and
eliminate the if?

same thing for 
  if(*n<0)__builtin_unreachable();

I see:
    _1 = *n_3(D);
    if (_1 < 0)
      goto <bb 3>; [INV]
    else
      goto <bb 4>; [INV]

2->3  (T) _1 :  int [-INF, -1]
2->4  (F) _1 :  int [0, +INF]

=========== BB 3 ============
    <bb 3> :
    __builtin_unreachable ();

And we can know that _1 is [0, +INF] from then on. 

Can we kill all these unreachables() the first time we see them if we set the
range appropriately?

If not, at what point do we want to kill them?

       reply	other threads:[~2020-11-19 23:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93917-4@http.gcc.gnu.org/bugzilla/>
2020-11-19 23:20 ` amacleod at redhat dot com [this message]
2022-11-03 19:30 ` amacleod at redhat dot com
2022-11-28 22:09 ` pinskia at gcc dot gnu.org
2023-09-19 15:11 ` amacleod at redhat dot com

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-93917-4-ORLPMB7Ien@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).