From patchwork Fri Jun 18 14:48:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 56195 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]) by ozlabs.org (Postfix) with SMTP id 6A3E41007D4 for ; Sat, 19 Jun 2010 00:48:54 +1000 (EST) Received: (qmail 5770 invoked by alias); 18 Jun 2010 14:48:52 -0000 Received: (qmail 5739 invoked by uid 22791); 18 Jun 2010 14:48:48 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Jun 2010 14:48:43 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id EE7F19AC89A; Fri, 18 Jun 2010 16:48:40 +0200 (CEST) Date: Fri, 18 Jun 2010 16:48:40 +0200 From: Jan Hubicka To: Bingfeng Mei Cc: Jan Hubicka , "gcc-patches@gcc.gnu.org" , Richard Guenther Subject: Re: PING: [PATCH, LTO] add externally_visible attribute when necessary with -fwhole-program and resolution file. Message-ID: <20100618144840.GA18733@kam.mff.cuni.cz> References: <7FB04A5C213E9943A72EE127DB74F0ADA66675B3BB@SJEXCHCCR02.corp.ad.broadcom.com> <7FB04A5C213E9943A72EE127DB74F0ADA66675B3DF@SJEXCHCCR02.corp.ad.broadcom.com> <7FB04A5C213E9943A72EE127DB74F0ADA6667D06B5@SJEXCHCCR02.corp.ad.broadcom.com> <7FB04A5C213E9943A72EE127DB74F0ADA6667D1209@SJEXCHCCR02.corp.ad.broadcom.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7FB04A5C213E9943A72EE127DB74F0ADA6667D1209@SJEXCHCCR02.corp.ad.broadcom.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 pass_ipa_whole_program_visibility. This is so to allow output from early IPA passes and early local optimization to be used by both at the compile time and link time. So variables/functions are externally visible per their visiblities first and then in pass_ipa_whole_program_visibility they might become static. This is why the conditional sets externally_visible to false. Not doing so you effectively disbale -fwhole-program. We might get around by not streaming externally_visible flag and not clearling it when in LTO mode (since it would not be set for other reasons) but this is bit fragile. We already have flag used_from_other_partition, this situation is similar, just it is not used from other partition but externally. Perhaps we can just add specific flag for this purpose and update cgraph_externally_visible_p to test for it? Honza Index: ipa.c =================================================================== --- ipa.c (revision 160529) +++ ipa.c (working copy) @@ -665,13 +665,12 @@ } gcc_assert ((!DECL_WEAK (node->decl) && !DECL_COMDAT (node->decl)) || TREE_PUBLIC (node->decl) || DECL_EXTERNAL (node->decl)); - if (cgraph_externally_visible_p (node, whole_program)) + if (!node->local.externally_visible + && cgraph_externally_visible_p (node, whole_program)) { gcc_assert (!node->global.inlined_to); node->local.externally_visible = true; } - else - node->local.externally_visible = false; This is not correct: the externally visible attribute is computed twice; once in pass_ipa_function_and_variable_visibility and second time in