public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Henderson <rth@redhat.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, jh@suse.cz, gcc@gcc.gnu.org
Subject: Re: [trans-mem] cgraph edges vs function cloning
Date: Wed, 29 Jul 2009 06:43:00 -0000	[thread overview]
Message-ID: <20090729064314.GC7178@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <4A6F8914.30705@redhat.com>

> On 07/28/2009 10:44 AM, Richard Henderson wrote:
> >I guess I'll poke at cleaning this up today. I've got to
> >familiarize myself with how virtual clones work...
> 
> The virtual clones that ipa-cp makes seems to be easy.
> 
> My thought here is that since (virtual) clones don't
> have actual bodies (and when they acquire bodies they
> cease to be clones), then there's no reason for them
> to have callee edges at all.  If you want the list of
> callees for a clone, you look at node->clone_of->callees.
> In this way, when we materialize a clone, we don't have
> to go looking for (and updating) edges, we just create
> them as we copy the statements.

This is not quite true, you can take function, clone it
and then clone one of callees.  Now one call to callee might need to
point to original, while other to the clone. To represent this and
similar transforms you need different set of edges for each clone.

Also the goal is to make clones appear as much as real functions as
possible for the optimizations, so they don't need to deal with too many
special cases.
> 
> What I don't understand is how the inliner uses clones.
> Can you explain this?

We don't apply inlining decisions at the time inliner decide inline A to
B.  Instead inline clone A is created and B's edge to A is redirected to this
clone to represent that later we will duplicate the body and inline it
into the function.

Also concerning your code, please note that clonning never created
identical copies, we had some problems here with saving for inlining.
Since we in general leave statements unfolded in various occasions and
inliner folds on handling some codes, we sometimes end up rendering part
of functions unreachable and removing it etc. even when not doing any
non-trivial substitutions.

Honza
> 
> 
> r~

  reply	other threads:[~2009-07-29  6:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23  1:39 Richard Henderson
2009-07-23 17:28 ` Jan Hubicka
2009-07-23 20:59   ` Richard Henderson
2009-07-27 23:08   ` Richard Henderson
2009-07-28 17:16     ` Jan Hubicka
2009-07-28 17:44       ` Richard Henderson
2009-07-28 23:26         ` Richard Henderson
2009-07-29  6:43           ` Jan Hubicka [this message]
2009-07-29  7:27           ` Martin Jambor
2009-07-29 16:24             ` Richard Henderson

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=20090729064314.GC7178@atrey.karlin.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc@gcc.gnu.org \
    --cc=jh@suse.cz \
    --cc=rth@redhat.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).