public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: PR 64454: Improve VRP for %
Date: Fri, 08 May 2015 09:14:00 -0000	[thread overview]
Message-ID: <CAFiYyc2eCPMqbdbt2JsOrHOw=yn2rGV-2mOBrQv9xJs8W-RvTA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1505041543340.2030@laptop-mg.saclay.inria.fr>

On Mon, May 4, 2015 at 3:57 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Mon, 4 May 2015, Richard Biener wrote:
>
>> On Sat, May 2, 2015 at 12:46 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
>>>
>>> Hello,
>>>
>>> this patch tries to tighten a bit the range estimate for x%y.
>>> slp-perm-7.c
>>> started failing by vectorizing more than expected, I assumed it was a
>>> good
>>> thing and updated the test. I am less conservative than Jakub with
>>> division
>>> by 0, but I still don't really understand how empty ranges are supposed
>>> to
>>> be represented in VRP.
>>>
>>> Bootstrap+testsuite on x86_64-linux-gnu.
>>
>>
>> Hmm, so I don't like how you (continute to) use trees for the constant
>> computations. wide-ints would be a better fit today.  I also notice that
>> fold_unary_to_constant can return NULL_TREE and neither the old nor your
>> code handles that.
>
>
> You are right. I was lazy and tried to keep this part of the old code, I
> shouldn't have...
>
>> "empty" ranges are basically UNDEFINED.
>
>
> Cool, that's what I did. But I don't see code adding calls to
> __builtin_unreachable() when an empty range is detected. Maybe that almost
> never happens?

No, it's just nobody bothered to implement it.  You also have to be careful
as you can't replace reproducers of UNDEFINED but only uses that still
result in UNDEFINED result (for example 0 * UNDEFINED is defined again).

What I'd like to do at some point is have some common code that you
can query what OP1 tree_code OP2 evaluates to if either op is UNDEFINED.
For example UNDEF + X == UNDEF but UNDEF * X == 0 (as optimistical
result, of course - the only not undefined case is for X == 0).  UNDEF << X == 0
but UNDEF >> X == signed(x) ? UNDEF : 0.

We have multiple passes that duplicate only parts of those "optimizations".

Having a central place implementing this correctly would be nice.

>> Aren't you pessimizing the case where the old code used
>> value_range_nonnegative_p() by just using TYPE_UNSIGNED?
>
>
> I don't think so. The old code only handled signed types in the positive
> case, while I have a more complete handling of signed types, which should do
> at least as good as the old one even in the positive case.

Ok, I see.

Richard.

> --
> Marc Glisse

  reply	other threads:[~2015-05-08  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 22:46 Marc Glisse
2015-05-04  8:58 ` Richard Biener
2015-05-04 13:57   ` Marc Glisse
2015-05-08  9:14     ` Richard Biener [this message]
2015-05-08 14:59       ` Marc Glisse
2015-05-08 15:28         ` 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='CAFiYyc2eCPMqbdbt2JsOrHOw=yn2rGV-2mOBrQv9xJs8W-RvTA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@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).