From: Marc Glisse <marc.glisse@inria.fr>
To: Richard Biener <rguenther@suse.de>
Cc: Richard Biener <richard.guenther@gmail.com>,
Marek Polacek <polacek@redhat.com>,
Jakub Jelinek <jakub@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Optimize (CST1 << A) == CST2 (PR tree-optimization/66299)
Date: Tue, 09 Jun 2015 12:13:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1506091355570.9052@stedding.saclay.inria.fr> (raw)
In-Reply-To: <alpine.LSU.2.11.1506091348160.30088@zhemvz.fhfr.qr>
On Tue, 9 Jun 2015, Richard Biener wrote:
> On Tue, 9 Jun 2015, Richard Biener wrote:
>
>> On Tue, 9 Jun 2015, Marc Glisse wrote:
>>
>>> On Tue, 9 Jun 2015, Richard Biener wrote:
>>>
>>>>> Tweaking it so that (6<<X)==0 becomes X>=31 for TYPE_OVERFLOW_WRAPS and
>>>>> false for TYPE_OVERFLOW_UNDEFINED is probably more controversial.
>>>>
>>>> Hm, yes. I think signed overflow != shift amount overflow, so testing the
>>>> overflow macros for this isn't valid.
>>>
>>> Would it be ok to always turn it to X>=31 then? (the value 31 is conveniently
>>> already computed in 'cand')
>>
>> I think so.
>
> Or even ((unsigned)X - 31) < 1 (I probably got that wrong) to properly
> say X>=29 && X<32, that is, preserve the implicit upper bound on X
> we have because it is used in a shift.
I don't understand in what sense this preserves the upper bound. I would
understand storing a range for X (when it is an SSA_NAME, and it would
require a lot of care not to propagate backwards too far), or more simply
introducing if(X>=32) __builtin_unreachable();. But you seem to be talking
about generating more complicated code so that if someone checks
(6<<123)==0 it returns false?
--
Marc Glisse
next prev parent reply other threads:[~2015-06-09 12:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 12:33 Marek Polacek
2015-05-28 13:10 ` Jakub Jelinek
2015-05-28 20:33 ` Marc Glisse
2015-06-08 15:12 ` Marek Polacek
2015-06-08 17:14 ` Marc Glisse
2015-06-09 7:56 ` Richard Biener
2015-06-09 11:46 ` Marc Glisse
2015-06-09 11:49 ` Richard Biener
2015-06-09 11:57 ` Richard Biener
2015-06-09 12:13 ` Marc Glisse [this message]
2015-06-09 12:22 ` Richard Biener
2015-06-09 13:46 ` Marek Polacek
2015-06-09 14:11 ` Richard Biener
2015-05-28 13:16 ` 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=alpine.DEB.2.20.1506091355570.9052@stedding.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=polacek@redhat.com \
--cc=rguenther@suse.de \
--cc=richard.guenther@gmail.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).