From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24348 invoked by alias); 29 Jul 2009 06:43:24 -0000 Received: (qmail 24340 invoked by uid 22791); 29 Jul 2009 06:43:23 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from atrey.karlin.mff.cuni.cz (HELO atrey.karlin.mff.cuni.cz) (195.113.26.193) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jul 2009 06:43:17 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id 7D850F00DA; Wed, 29 Jul 2009 08:43:14 +0200 (CEST) Date: Wed, 29 Jul 2009 06:43:00 -0000 From: Jan Hubicka To: Richard Henderson Cc: Jan Hubicka , jh@suse.cz, gcc@gcc.gnu.org Subject: Re: [trans-mem] cgraph edges vs function cloning Message-ID: <20090729064314.GC7178@atrey.karlin.mff.cuni.cz> References: <4A67BF29.9090208@twiddle.net> <20090723172828.GA20017@atrey.karlin.mff.cuni.cz> <4A6E333E.7060402@redhat.com> <20090728171601.GB7178@atrey.karlin.mff.cuni.cz> <4A6F38F3.5020402@redhat.com> <4A6F8914.30705@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A6F8914.30705@redhat.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00594.txt.bz2 > 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~