public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Andrew MacLeod <amacleod@redhat.com>,
	Aldy Hernandez <aldyh@redhat.com>,
	gcc-patches@gcc.gnu.org
Cc: msebor@redhat.com
Subject: Re: [PATCH] Rewrite get_size_range for irange API.
Date: Mon, 10 Aug 2020 14:27:20 -0600	[thread overview]
Message-ID: <f7afd3bf-d067-0159-9cf8-5038c4464858@gmail.com> (raw)
In-Reply-To: <ad8d3c77-cfe7-99b1-522d-6ee0a9af037f@redhat.com>

On 8/10/20 2:08 PM, Andrew MacLeod wrote:
> On 8/10/20 2:46 PM, Martin Sebor wrote:
>> On 8/10/20 11:50 AM, Andrew MacLeod wrote:
>>> On 8/10/20 12:35 PM, Martin Sebor via Gcc-patches wrote:
>>>> On 8/10/20 5:47 AM, Aldy Hernandez wrote:
>>
>>>
>>> int_range<X> is the type which allows for up to X subranges. 
>>> calculations will be merged to fit within X subranges
>>> widest_irange is the type which allows for "unlimited" subranges... 
>>> which currently happens to be capped at 255.. . (its typedef'd as 
>>> int_range<255>).
>>>
>>> widest_irange is the type used within the range-ops machinery and 
>>> such, and then whatever result is calculated is "toned down" to 
>>> whatever to user provides.
>>>
>>> so if union results in [5,10] and [20, MAX]   and you provide a 
>>> value_range for the result (, or int_range<1>), the result you get 
>>> back will be [5, MAX].. so won't look like there are any multi-ranges 
>>> going on.
>>
>> This is one part of the puzzle (for me).  I don't get [5, MAX] but
>> [0, MAX], on trunk as well as in GCC 10:
>>
>>   void f (unsigned n)
>>   {
>>     if (!((n >= 5 && n <= 10)
>>           || (n >= 20)))        // n2 = [5, 10] U [20, UINT_MAX]
>>       return;
>>
>>     if (n == 3)                 // not folded
>>       __builtin_abort ();
>>   }
>>
>> I'd expect this to get optimized regardless of Ranger (Clang folds
>> the whole function body into a return statement).
>>
> You mean like this? (from our branch.optimized output)  :-)
> 
> f (unsigned int n)
> {
>    <bb 2> [local count: 1073741824]:
>    return;
> }

Sweet!  I want!  ;-) https://www.youtube.com/watch?v=IrCEhRNgGHY

Martin


  reply	other threads:[~2020-08-10 20:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 14:53 Aldy Hernandez
2020-08-06 19:30 ` Martin Sebor
2020-08-10 11:47   ` Aldy Hernandez
2020-08-10 16:35     ` Martin Sebor
2020-08-10 17:50       ` Andrew MacLeod
2020-08-10 17:54         ` Aldy Hernandez
2020-08-10 18:46         ` Martin Sebor
2020-08-10 19:57           ` Andrew MacLeod
2020-08-10 20:08           ` Andrew MacLeod
2020-08-10 20:27             ` Martin Sebor [this message]
2020-08-11 11:56 ` PING: Fwd: " Aldy Hernandez
2020-08-26 14:27   ` Aldy Hernandez

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=f7afd3bf-d067-0159-9cf8-5038c4464858@gmail.com \
    --to=msebor@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@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).