public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Erick Ochoa <eochoa@gcc.gnu.org>
Cc: Jan Hubicka <hubicka@ucw.cz>, GCC Development <gcc@gcc.gnu.org>
Subject: Re: tree decl stored during LGEN does not map to a symtab_node during WPA
Date: Thu, 22 Jul 2021 14:48:20 +0200	[thread overview]
Message-ID: <CAFiYyc2Y4PkkxfcL=aNQ0+Letzcht1r0h2ApvNi2r7ywx-N2DA@mail.gmail.com> (raw)
In-Reply-To: <CAJ_nqzhj-0Ne-gpUDn9vr5nCqtDNnnrGHD-Ua7rmbB6DNUXXjg@mail.gmail.com>

On Thu, Jul 22, 2021 at 2:33 PM Erick Ochoa <eochoa@gcc.gnu.org> wrote:
>
> > > > 1. pid of lgen process that generated the encoding
> > > > 2. index returned by lto_symtab_encoder_encode
> > > > 3. varpool_node->name ()
> > > > 4. the pointer address being pointed by varpool node
> >
> > Well, yes, during LGEN no WPA has run.  Do you mean LTRANS after WPA?
> > Sure, the encoder numbers do not have to match up between different
> > LTRANS units but then they don't speak to each other so that shouldn't
> > matter, no?
>
> No. I mean during WPA. On a different e-mail I clarified the following:
>
> ```
> >
> > fopen $PID1 8 $ADDR1
> > fopen $PID2 7 $ADDR2
> >
>
> Just to clarify a bit further. $PID is generated and stored during
> LGEN. The encoding is obviously generated during LGEN.
> These are read during WPA. And the encoding is decoded and dyn_casted
> into a cgraph_node at WPA time.
> All these are printed during WPA.
> ```
>
> >
> > I _think_ that it should work if you stream at LGEN constraint variables
> > as their varpool node (using the varpool encoder), get the nodes merged
> > at WPA time, and thus your constraints from different LGEN runs "merged"
> > properly, then stream them the same way to the LTRANS units?
> >
>
> The only reference to a varpool encoder is on the Changelog. The only
> encoder I know of is the symtab_encoder (which I believe should be the
> same as varpool_nodes and cgraph_nodes are both symtab_nodes). But
> again, I do not know what you mean by "merged" here, since they have
> different addresses.

But the addresses are at LGEN time?  Note the nodes are actually
streamed to different instances by input_symtab, then decls are merged
(lto_symtab_merge_decls), then I think the IPA
pass summaries are read in (to different unmerged instances!), _then_
the symtab merging process starts (lto_symtab_merge_symbols).
I think the last step eventually calls the cgraph/varpool removal hook
IPA passes registered.

It might be that you need a replace hook to do what you want, I think
that for example IPA CP encodes references to global vars aka &global
as IPA_REF and those are transparently re-written.

As said, I think it can be made work but the details, since this is the
first IPA pass needing this, can be incomplete infra-structure-wise.

Basically you have summaries like

 'global = <fn::1>_3'

where the <fn::1> should eventually be implicit and the constraints
grouped into constraints generated from the respective function body
and constraints generated by call stmts (not sure here), and constraints
for global variable init.  But for the above constraint the point is to
make the 'global' references from different LGEN units the same by
some means (but not streaming and comparing the actual assembler name).

> >
> > And the same solution should exist.  For "merged" function definitions
> > (like multiple same inline definitions) you'd simply drop all but one set of
> > constraints.
> >
>
> Yes, this is what I would like, but I don't see how to detect "merged"
> function definitions. I can get their cgraphs but as I mentioned for
> every encoding I decode and dyn_cast all I get is a cgraph holding a
> different address. What does "merged" concretely mean?

One node is dropped and all references are adjusted.  And somehow
IPA passes are notified about this _after_they have read their
summaries.

Richard.

  reply	other threads:[~2021-07-22 12:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  9:27 Erick Ochoa
2021-07-09  7:51 ` Erick Ochoa
2021-07-09  9:49   ` Richard Biener
2021-07-12 10:55     ` Erick Ochoa
2021-07-13  9:21       ` Erick Ochoa
2021-07-13  9:41         ` Richard Biener
2021-07-13 10:49           ` Erick Ochoa
2021-07-13 12:55             ` Richard Biener
2021-07-14 13:56               ` Erick Ochoa
2021-07-15  7:23                 ` Richard Biener
2021-07-21 16:55                   ` Erick Ochoa
2021-07-22 11:40                     ` Richard Biener
2021-07-22 12:04                       ` Erick Ochoa
2021-07-22 12:08                         ` Erick Ochoa
2021-07-22 12:23                         ` Richard Biener
2021-07-22 12:33                           ` Erick Ochoa
2021-07-22 12:48                             ` Richard Biener [this message]
2021-07-22 14:32                               ` Erick Ochoa
2021-07-28 10:35                                 ` Richard Biener
2021-07-13 11:56           ` Erick Ochoa

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='CAFiYyc2Y4PkkxfcL=aNQ0+Letzcht1r0h2ApvNi2r7ywx-N2DA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=eochoa@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /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).