public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC <gcc@gcc.gnu.org>, Jeff Law <law@redhat.com>,
	Aldy Hernandez <aldyh@redhat.com>
Subject: Re: On-Demand range technology [2/5] - Major Components : How it works
Date: Tue, 04 Jun 2019 16:50:00 -0000	[thread overview]
Message-ID: <1ea49339-a190-9004-c20a-f001ebb9ba97@redhat.com> (raw)
In-Reply-To: <CAFiYyc2UYPDjPqo4DEEmH9wcDsy_ezaQhgm750pou-TcOJWuLQ@mail.gmail.com>

On 6/4/19 11:37 AM, Richard Biener wrote:
> On Tue, Jun 4, 2019 at 5:26 PM Richard Biener
> <richard.guenther@gmail.com> wrote:
>>
>> But you still have a reference to the range in evry BB dominated by the
>> definition?
> Btw, I was thinking of
>
> unsigned char foo(long);
> void baz(unsigned char c)
> {
>    try{
>        long i = c;
>        i += foo(i);
>        i += foo(i);
>        i += foo(i);
>        i += foo(i);
> ... repeat N times ...
>       alloca(i); // query range of i
>    }
>    catch (...)
>      {
>      }
> }
>
>
> where the single(!) query of the range of i on the alloca call
> will populate N BBs caches with the Nth having ranges for
> all SSA defs of i running into quadraticness in N.
well, not really.   its still linear since the 'i' used in each foo() 
will be dead, so the next block will contain no range for it


   try{
       long i_2 = _1;
       i_3 += foo(i_2);
       i_4 += foo(i_3);
       i_5 += foo(i_4);
       i_6 += foo(i_5);
... repeat N times ...
      alloca(i_6); // query range of i

once i_2 is 'dead' after the first call to foo(), it will no longer be 
in the on-entry cache to any other block.
The walk back never see's i_2 until the first call to foo(), so none of 
blocks after that have a need for its range, so it will not in their caches.

The on-entry cache will only get a single range entry for each of those 
blocks.. the incoming value of i_x  and thats it. The implicitly known 
live-on-exit attribute is handy here.

Now, that's not to say we cant construct cases where there is a lot of 
ranges being populated.. If we find the cache is really a problem, we 
can start caching ranges.. so that if all these i_x's were live somehow, 
there would only be one range for each in this case, and the cache's 
would simply all point to the same range.

so far we havent really run across anything that appears to trigger 
significant concerns.



>
> If you actually try you probably will have to find a persisting
> stmt that some user of on-demand query looks for.
> You converted some of the warning passes so choose
> a stmt that triggers it from there.
>
> Note we've run into "interesting" testcases mostly from
> machine generated code which we still want to be able
> to optimize at -O1 at least with reasonable use of
> time and memory (and quadraticnesses are to be avoided
> like a plague - not that we don't have some).
>
>>>   I think thats the
>>> most common value, so that should reduce a large number of them.   I've
>>> also considering caching ranges like we cache tree constants... but I
>>> haven't delved into that.  I figured if memory turns out to be a
>>> problem, then we'll look at it then.
>>>
>>> Andrew
>>>

  reply	other threads:[~2019-06-04 16:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23  1:28 Andrew MacLeod
2019-05-23 12:55 ` Richard Biener
2019-05-24 15:50   ` Andrew MacLeod
2019-05-27 13:03     ` Richard Biener
2019-05-28 14:17       ` Andrew MacLeod
2019-05-29 11:16         ` Richard Biener
2019-05-31 15:40           ` Andrew MacLeod
2019-05-31 18:16             ` Jeff Law
2019-05-31 20:27               ` Andrew MacLeod
2019-05-31 22:00                 ` Jeff Law
2019-05-31 23:08                   ` Andrew MacLeod
2019-06-04 15:27             ` Richard Biener
2019-06-04 15:38               ` Richard Biener
2019-06-04 16:50                 ` Andrew MacLeod [this message]
2019-06-04 17:07                   ` Richard Biener
2019-06-04 19:55                     ` Andrew MacLeod
2019-06-05  9:59                       ` Richard Biener
2019-06-04 16:49               ` Andrew MacLeod
2019-06-04 20:04             ` Martin Sebor
2019-06-04 20:22               ` Marc Glisse
2019-06-04 21:40                 ` Andrew MacLeod

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=1ea49339-a190-9004-c20a-f001ebb9ba97@redhat.com \
    --to=amacleod@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=law@redhat.com \
    --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).