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: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] tree-optimization/103721 - Only add equivalencies that are still valid.
Date: Wed, 19 Jan 2022 13:41:29 -0500	[thread overview]
Message-ID: <ce31b8e8-3186-39f2-9ac7-f879f43e792d@redhat.com> (raw)
In-Reply-To: <CAFiYyc3W1SByr27+Jg=-oYjaqsUWJeSJxJQi7vq5O_UWpbAQvg@mail.gmail.com>

On 1/19/22 04:33, Richard Biener wrote:
> On Wed, Jan 19, 2022 at 2:37 AM Andrew MacLeod via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> OK for trunk?
> OK.  I don't quite understand how what you describe above works, it sounds
> a bit odd with respect to the idea that equivalences should be transitive but
The transitive check is what prevents us from having to find and update 
all the equivalence sets when a name needs to be removed.  we can simply 
create a new equivalence with that name, and all the older equivalences 
in the dom tree will no longer equate with it and are eliminated by the 
query.  With the nature of on-demand, its possible for equivalences to 
get created in unexpected orders, and logging all the equivalences as 
they are seen and leaving the final determination to query time seems to 
be the easiest and most accurate way to get results.  I suspect we miss 
a few relations if we process things in a  random order, but we 
shouldn't get anything wrong.
> I should note that forming equivalences from PHI nodes with backedges
> is not possible without being very careful since you will easily end up
> equating _1 and _1 from different iterations (and thus with different value).

The dominator search version used by ranger won't create equivalences 
from back edges normally because the back edge doesn't dominate the 
block.  The only time we could get an equivalence from a back edge would 
be if all the other arguments to a PHI at the top of the loop were 
undefined, or the same value as came in on the back edge

ie

top_5 = PHI<val_6(2), val_6(8)>  would create an equivalence between 
top_5 and val_6...   but that's OK because it is just a copy then anyway.

or

top_5 = PHI <undefined(2), val_6(8)>

This will create an equivalence between top_5 and val_6 in the loop, 
until we reach the point where val_6 is defined, and then the 
equivalence will get killed.  its possible that might cause an issue in 
a single BB loop, If I could reproduce that...  let me experiment.  In 
which case I'll simply disable equivalences applied to PHIs if its 
driven by just a back edge.

I dont see any other way we can get an equivalence/relation from a back 
edge with the oracle (other than what the threader does, it has its own 
oracle extensions for paths)

Its on my task list to document the entire oracle mechanism for both 
equivalences and relations in the next month or two.

Andrew


  reply	other threads:[~2022-01-19 18:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  1:36 Andrew MacLeod
2022-01-19  9:33 ` Richard Biener
2022-01-19 18:41   ` Andrew MacLeod [this message]
2022-01-20  8:42     ` 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=ce31b8e8-3186-39f2-9ac7-f879f43e792d@redhat.com \
    --to=amacleod@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).