From patchwork Fri Sep 12 14:32:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 388681 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 DFA71140095 for ; Sat, 13 Sep 2014 00:34:03 +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:from :to:cc:subject:date:message-id; q=dns; s=default; b=nEoaDR3Jle1c fcfpo3UcmnHGcQeSlONZVYbTaKVRosjLpiV/LYz8yMoc79thz6njwsyqOFgeTfJm gI/zBmmXeq+JGPcCjt44VCjFalGZ+29HfUWueJTcjA3UdcU4oNeOqBM6xrfgGu9V y2pBV15rvEm3xzbBArv3v8fzYH0qTxQ= 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:from :to:cc:subject:date:message-id; s=default; bh=50IrCx0CwrdM+08bnr 5zsgbQyGk=; b=gFIYnW7NHDJv3JkRUYQeGwetSUDso6uPrtPtCVm8p6PFYIEXW2 fcyouAMSAcYUmRR/2jlawfnrAOR8lZrYTV51auyFOyEAMhRDZMXIvdxBdu9hpmHp gu4CMoZ7aBdSaUkeiSoQKi3EWGElj8wrfmWn6oZ2Pf2AaAgxy5tPTJPwI= Received: (qmail 20219 invoked by alias); 12 Sep 2014 14:33:57 -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 20197 invoked by uid 89); 12 Sep 2014 14:33:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Sep 2014 14:33:56 +0000 Received: from basil.firstfloor.org (184-100-254-193.ptld.qwest.net [184.100.254.193]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id CF40086A05; Fri, 12 Sep 2014 16:33:50 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id C5520A1F75; Fri, 12 Sep 2014 07:33:01 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH 1/2] Always set DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT correctly Date: Fri, 12 Sep 2014 07:32:56 -0700 Message-Id: <1410532377-13147-1-git-send-email-andi@firstfloor.org> From: Andi Kleen When profiling is disabled force DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT for each function to one. This information is then preserved through LTO. With this patch for LTO builds -pg needs to be set on both the LTO final link and the original source build, to allow -pg (or -pg -fentry) to be active for that source file. This allows to build large projects mostly with -pg, except for a few files, and still use LTO. Originally suggested by Richard Biener Passes bootstrap and testing on x86_64-linux. gcc/: 2014-09-11 Andi Kleen * function.c (allocate_struct_function): Force DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT to zero when profiling is disabled. --- gcc/function.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/function.c b/gcc/function.c index c8daf95..f07fdcf 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4555,6 +4555,9 @@ allocate_struct_function (tree fndecl, bool abstract_p) but is this worth the hassle? */ cfun->can_throw_non_call_exceptions = flag_non_call_exceptions; cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions; + + if (!profile_flag && !flag_instrument_function_entry_exit) + DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) = 1; } }