From patchwork Sat Jan 3 06:19:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 425089 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 679DF14007D for ; Sat, 3 Jan 2015 17:19:17 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=SzC+3NDkOsgu5uyEQRGT1yK4ZAojYUDpr/IESPuJrJp uvgjjv0kjMSL4REztqI1NE6uq/D3tx7ObYLC0td7S9Q0e/FOoPCAi7hAnN9jwMTF TRSUPmTx3FAnOY7JPS91wp5wA5LyqTPbuETyZ0zZ7HwcuYvzocT7ZP6FnjASLNIQ = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=gB7JKl4VpByvBdZS1bsbli0lZ3E=; b=OICewJ6uh7PVbj5FV lXEDlVfEthLTJJ7LVMypHWoEPW9GQAXLSqqyPqZoW96eeCXtE4ZrFoo2evB0NrX7 YPSCMOUlaMNXQygfop5qjrMFXUDOL3f/VJc/f0flWvSV8OQC88/jpF2B87u969IX Yu+HpxyoovKjwx4P8wPQgxEZ6k= Received: (qmail 20314 invoked by alias); 3 Jan 2015 06:19:09 -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 20303 invoked by uid 89); 3 Jan 2015 06:19:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-oi0-f44.google.com Received: from mail-oi0-f44.google.com (HELO mail-oi0-f44.google.com) (209.85.218.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 03 Jan 2015 06:19:06 +0000 Received: by mail-oi0-f44.google.com with SMTP id a141so8715161oig.3 for ; Fri, 02 Jan 2015 22:19:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=8b/8HhWESj6O18MuXZcXZKWSAUgsiR4M/v8ytluytHY=; b=Hsohsfr4mhiLgEwV3J0zg8ly3Az/NtOV7CmU+QatFjjvMXCRzqrQDB8d+uFry9OyhT nqRHxYYYl50S0QD5PR18QBRkyu9TYDiPRHwKp4d0APlEKvfCaWfSr1eT+Yu++F6CtOxj cH15pFu3iTnVQeICxWEshkCRU1bN1322TRjOX77V8XA9JIsNOjP0S7T5VG3FLgbQJkPl X3z4fSFoZAtuSEX/CqxA6AIVfhiZW84Jq4JkmxrHAl3Bk62ZjyaxssABfy3NHK2AOey6 rkbEMI7C5nzAMNkBovXIETCwb5QzVw+aI7S66+RzPQoWPbrex4cHXQRESoWpmeV41HIi IFOA== X-Gm-Message-State: ALoCoQmA3UCaAsQ3MPiR6x0jgyZB8+UahPuSPRGPj6nmvRAOuhdJyDidLVU7eyPKBkd4AFB8totj MIME-Version: 1.0 X-Received: by 10.202.48.82 with SMTP id w79mr44259315oiw.30.1420265944672; Fri, 02 Jan 2015 22:19:04 -0800 (PST) Received: by 10.76.0.44 with HTTP; Fri, 2 Jan 2015 22:19:04 -0800 (PST) Date: Fri, 2 Jan 2015 22:19:04 -0800 Message-ID: Subject: [GOOGLE] Refine LIPO aux function removal From: Teresa Johnson To: Xinliang David Li Cc: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes Fixes a problem caused by my recent change to allow aux functions to be removed. They need to be kept until after LIPO linking/static promotion, since they affect the promoted names of any static variables defined within their context. Passes regression and internal testing. Ok for google/4_9? Thanks, Teresa 2015-01-02 Teresa Johnson Google ref b/18882262. * cgraph.c (cgraph_can_remove_if_no_direct_calls_and_refs_p): Keep aux functions until after LIPO linking. Index: cgraph.c =================================================================== --- cgraph.c (revision 219100) +++ cgraph.c (working copy) @@ -2462,8 +2462,13 @@ cgraph_can_remove_if_no_direct_calls_and_refs_p (s { gcc_assert (!node->global.inlined_to); /* Extern inlines can always go, we will use the external definition. */ - if (DECL_EXTERNAL (node->decl) || cgraph_is_aux_decl_external (node)) + if (DECL_EXTERNAL (node->decl)) return true; + /* Aux functions are safe to remove, but only once static promotion is + complete since they may affect promoted names if they are the context + for any static variables. */ + if (cgraph_pre_profiling_inlining_done && cgraph_is_aux_decl_external (node)) + return true; /* When function is needed, we can not remove it. */ if (node->force_output || node->used_from_other_partition) return false;