From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
Andrew MacLeod <amacleod@redhat.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Avoid generating useless range info
Date: Thu, 29 Jun 2017 09:53:00 -0000 [thread overview]
Message-ID: <CAFiYyc3gTbXVf0t2N3c2bBN9qV1qDZdwr3sBAaNabyX59Sj5Pg@mail.gmail.com> (raw)
In-Reply-To: <0c48f7c0-6fff-c8f3-5680-e4a0fc3203bf@redhat.com>
On Wed, Jun 28, 2017 at 9:56 AM, Aldy Hernandez <aldyh@redhat.com> wrote:
>
>
> On 06/27/2017 06:38 AM, Jakub Jelinek wrote:
>>
>> On Tue, Jun 27, 2017 at 06:26:46AM -0400, Aldy Hernandez wrote:
>>>
>>> How about this?
>>
>>
>> @@ -360,6 +363,22 @@ set_range_info (tree name, enum value_range_type
>> range_type,
>> }
>> }
>> +/* Store range information RANGE_TYPE, MIN, and MAX to tree ssa_name
>> + NAME while making sure we don't store useless range info. */
>> +
>> +void
>> +set_range_info (tree name, enum value_range_type range_type,
>> + const wide_int_ref &min, const wide_int_ref &max)
>> +{
>> + /* A range of the entire domain is really no range at all. */
>> + tree type = TREE_TYPE (name);
>> + if (min == wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type))
>> + && max == wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)))
>> + return;
>> +
>> + set_range_info_raw (name, range_type, min, max);
>> +}
>> +
>>
>> Won't this misbehave if we have a narrower range on some SSA_NAME and
>> call set_range_info to make it VARYING?
>> In that case (i.e. SSA_NAME_RANGE_INFO (name) != NULL), we should either
>> set_range_info_raw too (if nonzero_bits is not all ones) or clear
>> SSA_NAME_RANGE_INFO (otherwise).
>
>
> Good point. Fixed.
>
>> /* Gets range information MIN, MAX and returns enum value_range_type
>> corresponding to tree ssa_name NAME. enum value_range_type returned
>> @@ -419,9 +438,13 @@ set_nonzero_bits (tree name, const wide_int_ref
>> &mask)
>> {
>> gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
>> if (SSA_NAME_RANGE_INFO (name) == NULL)
>> - set_range_info (name, VR_RANGE,
>> - TYPE_MIN_VALUE (TREE_TYPE (name)),
>> - TYPE_MAX_VALUE (TREE_TYPE (name)));
>> + {
>> + if (mask == -1)
>> + return;
>> + set_range_info_raw (name, VR_RANGE,
>> + TYPE_MIN_VALUE (TREE_TYPE (name)),
>> + TYPE_MAX_VALUE (TREE_TYPE (name)));
>> + }
>> range_info_def *ri = SSA_NAME_RANGE_INFO (name);
>> ri->set_nonzero_bits (mask);
>>
>> Similarly, if SSA_NAME_RANGE_INFO is previously non-NULL, but min/max
>> are VARYING and the new mask is -1, shouldn't we free it rather than
>> set it to the default?
>
>
> Here, if SSA_NAME_RANGE_INFO is previously non-NULL then we proceed as
> always-- just set the nonzero bits to whatever was specified (without
> clearning SSA_NAME_RANGE_INFO). A mask of -1 and an SSA_NAME_RANGE_INFO of
> non-NULL can coexist just fine.
>
> How about this?
Ok.
Thanks,
Richard.
> Aldy
next prev parent reply other threads:[~2017-06-29 9:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 16:41 Aldy Hernandez
2017-06-16 8:00 ` Richard Biener
2017-06-23 9:02 ` Aldy Hernandez
[not found] ` <CAGm3qMXOYa3Km6FGiji0j2txeZJfyiLTR7V6EDMTDEDQo0RWBA@mail.gmail.com>
2017-06-23 10:24 ` Richard Biener
2017-06-23 10:32 ` Jakub Jelinek
2017-06-23 11:01 ` Richard Biener
2017-06-27 10:26 ` Aldy Hernandez
2017-06-27 10:38 ` Jakub Jelinek
2017-06-28 7:56 ` Aldy Hernandez
2017-06-29 9:53 ` Richard Biener [this message]
2017-08-02 13:29 ` [testsuite, committed] Use relative line number in gcc.dg/Walloca-14.c Tom de Vries
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=CAFiYyc3gTbXVf0t2N3c2bBN9qV1qDZdwr3sBAaNabyX59Sj5Pg@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@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).