From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29000 invoked by alias); 29 Jul 2009 07:27:50 -0000 Received: (qmail 28986 invoked by uid 22791); 29 Jul 2009 07:27:49 -0000 X-SWARE-Spam-Status: No, hits=-7.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_13,RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jul 2009 07:27:42 +0000 Received: from relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 1D41D9295B; Wed, 29 Jul 2009 09:27:39 +0200 (CEST) Date: Wed, 29 Jul 2009 07:27:00 -0000 From: Martin Jambor To: Richard Henderson Cc: Jan Hubicka , jh@suse.cz, gcc@gcc.gnu.org Subject: Re: [trans-mem] cgraph edges vs function cloning Message-ID: <20090729072854.GA4808@alvy.suse.cz> Mail-Followup-To: Richard Henderson , Jan Hubicka , jh@suse.cz, gcc@gcc.gnu.org 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=iso-8859-2 Content-Disposition: inline In-Reply-To: <4A6F8914.30705@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00595.txt.bz2 Hi, On Tue, Jul 28, 2009 at 04:26:12PM -0700, Richard Henderson wrote: > 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. That is not really true. Consider the following example: static void a (int i) { DO_SOMETHING_WITH_I (i); } void b (int i) /* Not static! */ { a (i); } void c (void) { b (2); } After ipa-cp (even today), we might end up with a call graph where c would call b.clone.0 which in turn would call a.clone.1, while the original b would still call the original a. Moreover, I have an ipa-cp improvemant patch that removes callee edges of virtual clones if it can prove that they are never called after a constant is substituted into a parameter, like in the example below: int f(int i) { if (i == 0) { call_some_nasty_function(...); } ... } int g() {return f(1);} Martin