public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Erick Ochoa <eochoa@gcc.gnu.org>
To: Martin Jambor <mjambor@suse.cz>
Cc: gcc@gcc.gnu.org
Subject: Re: Question about speculative make_edge_direct_to_target during LTO/IPA_PASS
Date: Thu, 7 Jul 2022 15:20:33 +0200	[thread overview]
Message-ID: <CAJ_nqzhdMJpGj_u4Cak6ZYcG=W5JR1Ersvm8Z6QuBz4NFGN0cQ@mail.gmail.com> (raw)
In-Reply-To: <ri6y1xdhuck.fsf@suse.cz>

On Fri, 1 Jul 2022 at 14:48, Martin Jambor <mjambor@suse.cz> wrote:

> Why so late, why not as part of number 4?
>

Hi Martin,

Thanks for the feedback. The original reason why the call to
make_edge_direct_to_target was done so late is because of the lack of
function bodies during WPA, summaries with insufficient information (I keep
track of only some information which when access to function bodies is
given during LTRANS I can finally have a cgraph_edge to use as a
parameter), and I am still figuring out things with edge summaries.

I have a couple of questions here to improve my summaries:

If I were to call make_edge_direct_to_target during WPA (or number 4) then
I need to have access to the indirect edge during WPA. This is because
make_edge_direct_to_target receives a cgraph_edge as a parameter. In order
to have access to the indirect edge during WPA, I need to generate
summaries which keep track of indirect edges.

I think this would be done with edge summaries. Again, my understanding of
edge summaries is incomplete. My understanding is that they contain
information to be transmitted along the edges of the call graph. However,
the implementation details are what is making it difficult for me to
understand. Unlike cgraph_nodes which can be encoded and decoded, it seems
to me that cgraph_edges have no encoding nor decoding. This makes it
somewhat hard to say that an information belongs to a given edge.

Looking into ipa-cp / ipa-prop it looks like edge summaries are stored by
first encoding the caller cgraph_node and then iterating over the edges in
the node->callees and node->indirect_calls. However, I know that edges can
be removed. That's why there are edge removal hooks. Shouldn't this affect
the information that is written if an edge was removed somewhere else?
Something that is not explicit, is also that the order in the node->callees
and node->indirect_calls is preserved from the moment the summary is
written to the moment the summary is read. Is this the case?

My understanding is also limited from the fact that ipa-cp does not have a
proper write_summary nor read_summary stages in its own class and instead
ipa-cp's summaries are written and read during ipa-prop. Is this an
implementation detail so that the edge information created for ipa-cp is
propagated correctly during inlining? (Or is there some other explanation
for this?) Would it also makes sense to write and read my edge summaries at
the same time as ipa-cp's edge summaries? I know that the base class
(call_summary) also has virtual methods for removal and duplication of
edges (which should be triggered during inlining / cleaning up of the
callgraph). But somehow the virtual methods ::remove and ::duplicate seem
different to me from the callbacks which need to be registered in the
IPA_PASSes. Again, why would one need to write and read ipa-cp's summaries
during ipa-prop if these callbacks exist which are triggered when summaries
need to be updated?

Thanks!

-Erick

  reply	other threads:[~2022-07-07 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01  9:46 Erick Ochoa
2022-07-01 12:48 ` Martin Jambor
2022-07-07 13:20   ` Erick Ochoa [this message]
2022-07-08 15:31     ` Martin Jambor
2022-07-14 12:40       ` 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='CAJ_nqzhdMJpGj_u4Cak6ZYcG=W5JR1Ersvm8Z6QuBz4NFGN0cQ@mail.gmail.com' \
    --to=eochoa@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=mjambor@suse.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).