public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA][PATCH][tree-optimization/78496] 01/03 Do not lose range information from earlier VRP passes
Date: Mon, 04 Dec 2017 08:12:00 -0000	[thread overview]
Message-ID: <20171204081158.GI2353@tucnak> (raw)
In-Reply-To: <b1a2833c-5f5b-fa70-3813-c152daa73552@redhat.com>

On Sun, Dec 03, 2017 at 10:55:27PM -0700, Jeff Law wrote:
> As we touched on in IRC, the EVRP analyzer was doing something stupid
> which caused it to not merge in existing range information under certain
> circumstances.
> 
> Consider this fragment:
> 
>   x_1 = foo ()
>   if (x_1 > 2)
>     __builtin_unreachable ();
>   if (x_1 < 0)
>     __builtin_unreachable ();

Note that for say:
  x_1 = foo ();
  bar (x_1);
  if (x_1 > 2)
    __builtin_unreachable ();
  if (x_1 < 0)
    __builtin_unreachable ();
  ...
  further uses of x_1
we can't do that anymore (at least, can't remember it in
SSA_NAME_RANGE_INFO), as bar could not return/could loop etc.  Ditto with
any other code in between foo and the unreachable asserts if it doesn't
guarantee that we'll always reach the comparisons after the x_1 setter.
Even
  x_1 = foo ();
  bar ();
  if (x_1 > 2)
    __builtin_unreachable ();
  if (x_1 < 0)
    __builtin_unreachable ();
looks unclean, if bar doesn't return, then we'd just need to hope we don't
add further uses of x_1 in between foo and bar.  Some optimizations do stuff
like that, consider foo being a pass-through function.

	Jakub

  reply	other threads:[~2017-12-04  8:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04  5:55 Jeff Law
2017-12-04  8:12 ` Jakub Jelinek [this message]
2017-12-04 15:14   ` Jeff Law
2017-12-04 11:01 ` 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=20171204081158.GI2353@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@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).