public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Aldy Hernandez <aldyh@redhat.com>, GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Implement a context aware points-to analyzer for use in evrp.
Date: Wed, 9 Jun 2021 15:02:27 -0400	[thread overview]
Message-ID: <b6235b40-fce1-6896-4f67-948694f7a788@redhat.com> (raw)
In-Reply-To: <CAFiYyc0iK35Y_QYc7VR3uLdW3WCTGN9THHe_-1T8-C198CDV7A@mail.gmail.com>

On 6/9/21 7:32 AM, Richard Biener wrote:
> On Tue, Jun 8, 2021 at 4:31 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>>
>> an iteration causes a relation
>> to become "better" it should be updated.
>>> do a very simplistic thing when trying to simplify downstream conditions
>>> based on earlier ones, abusing their known-expressions hash tables
>>> by, for example, registering (a < b) == 1, (a > b) == 0, (a == b) == 0,
>>> (a != b) == 1 for an earlier a < b condition on the true edge.  So I wonder
>>> if this relation code can be somehow used there.  In VN there's the
>>> extra complication that it iterates, but DOM is just a DOM-walk and
>>> the VN code also has a non-iterating mode (but not a DOM walk).
> Note VN does optimistic iteration thus relations will become only "worse",
> thus we somehow need to be able to remove relations we added during
> the last iteration.  That is, in the first iteration a if (a > b) might be
> registered as a > 1 when b has (optimistic) value b but in the second
> we have to make it a > b when b dropped to varying for example.
>
> The optimistic part of VN is that it treats all edges as not executable
> initially and thus it ignores values on non-executable edges in PHI
> nodes.
>
Yeah, haven't had to do that yet.  The add method currently does an 
intersection with any relation it finds already present, it shouldn't be 
too much work to add an alternate add routine that says "replace".  In 
fact, that may be also be adequate for my purposes, since typically the 
second time a relation is added, it *should* be either the same, or 
"better" for me.   The tricky part is I think it may already include any 
relation that dominates the currently location..  but that is addressable.

I'll keep an eye on this as I'm prepping the code and writing it up.

>> The API is for registering is pretty straightforward:
>>
>>     void register_relation (gimple *stmt, relation_kind k, tree op1, tree
>> op2);
>>     void register_relation (edge e, relation_kind k, tree op1, tree op2);
>>
>> so all you'd have to do when a < b is encountered is to register  (a
>> LT_EXPR b) on the true edge, and (a GE_EXPR b) on the false edge.  Then
>> any queries downstream should be reflected.
>>
>>
>>
>>> Of course the code is also used to simplify
>>>
>>>    if (a > b)
>>>       c = a != b;
>>>
>>> but the relation oracle should be able to handle that as well I guess.
>>>
>>>
>>>
>>> As we start using the code more, we may find we want/need a few more
>>> wrappers around some of this so that you can transparently ask what the
>>> RHS folds to without any ranger present, just with relations.  Those'll
>>> be fairly trivial to add...
>>>
>>> The relation oracle is going to be directly accessible from the
>>> get_range_query(cfun) range_query class.  I'll do a big writeup when i
>>> submit it and we should be able to make it usable in any of those places.
> OK, so using this from DOM should be pretty straight-forward (you may
> want to try to use it there as proof of API sanity).  When it's in I'll see if
> it fits (iterative) VN.
>
Yeah, it should be quite straightforward as part of DOM.. and should be 
easy to set and query in parallel with whats there to verify its getting 
the same results.  Famous last words.  But yes, this would be further 
proof its evaluating what we expect on top of doing what EVRP did.

Slight delay while I'm sorting out some minor API issues to enable using 
this without ranger right off the bat, as well as interaction with some 
recent changes I made.

Andrew




      reply	other threads:[~2021-06-09 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 10:10 Aldy Hernandez
2021-06-07 10:12 ` Aldy Hernandez
2021-06-07 13:30 ` Richard Biener
2021-06-07 18:29   ` Aldy Hernandez
2021-06-09 17:10     ` Martin Sebor
2021-06-09 18:50       ` Aldy Hernandez
2021-06-09 19:01         ` Martin Sebor
2021-06-07 19:20   ` Andrew MacLeod
2021-06-08  6:26     ` Aldy Hernandez
2021-06-08 12:32       ` Andrew MacLeod
2021-06-08  7:26     ` Richard Biener
2021-06-08 14:31       ` Andrew MacLeod
2021-06-09 11:32         ` Richard Biener
2021-06-09 19:02           ` Andrew MacLeod [this message]

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=b6235b40-fce1-6896-4f67-948694f7a788@redhat.com \
    --to=amacleod@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).