From patchwork Mon Aug 26 15:46:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 269918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 715732C008E for ; Tue, 27 Aug 2013 01:47:06 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=cAwZDYciSf/MeR43q56HyzmIzZJvrG/04W0riLC7isZnFQtTfOCCF 1g4paJL0XokVgZ7WRoelmj4Zzn+37ec8aslC8ugcpIv6mveIpfN4/l6LAXhU8J6Y CXytiJByLjcWTGOEYVZC0vxpSfuy3KKsCrhfW6TFVK4HRjbiD5LQ+E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=b4tDeKfxkEeRkoY5NLcV6PVlD1s=; b=Cf96azWh9w0DMIcayNy9 QAGTBFGDJepgWrIi3i5zoDK76zcToVZ33B9mfZZJkaAf1riywB3/yYRMt/DI2dKs DiB9a+RmceNgBo3cYZZvzXrYLo0FmKAnMEhgq8qGp+TOkhX/c/lYjFgtdYCurAg1 x1dUCtF1BUsbUNO+oYLHj+g= Received: (qmail 20380 invoked by alias); 26 Aug 2013 15:47:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 20369 invoked by uid 89); 26 Aug 2013 15:46:59 -0000 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 26 Aug 2013 15:46:59 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7D76E541897; Mon, 26 Aug 2013 17:46:56 +0200 (CEST) Date: Mon, 26 Aug 2013 17:46:56 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Do not turn virtual methods cold based on absence of direct calls Message-ID: <20130826154656.GC6539@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, on firefox we turn some virtual methods cold just because we think that if they are not called directly and not having address taken, we won't need them. Unless we track call targets of polymorphic calls better, we should not try to touch them until after inlining (when those will just disappear). Bootstrapped/regtested x86_64-linux, comitted. Index: ChangeLog =================================================================== --- ChangeLog (revision 202002) +++ ChangeLog (working copy) @@ -1,5 +1,10 @@ 2013-08-26 Jan Hubicka + * cgraph.c (cgraph_propagate_frequency): Do not assume that virtual + methods can not be called indirectly when their address is not taken. + +2013-08-26 Jan Hubicka + * gimple-fold.c (gimple_get_virt_method_for_binfo): Use ctor_for_folding. 2013-08-26 Jan Hubicka Index: cgraph.c =================================================================== --- cgraph.c (revision 202000) +++ cgraph.c (working copy) @@ -2348,7 +2348,10 @@ cgraph_propagate_frequency (struct cgrap struct cgraph_propagate_frequency_data d = {true, true, true, true}; bool changed = false; - if (!node->local.local) + /* We can not propagate anything useful about externally visible functions + nor about virtuals. */ + if (!node->local.local + || (flag_devirtualize && DECL_VIRTUAL_P (node->symbol.decl))) return false; gcc_assert (node->symbol.analyzed); if (dump_file && (dump_flags & TDF_DETAILS))