From patchwork Tue Oct 15 17:58:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 283762 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 did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 56E532C0095 for ; Wed, 16 Oct 2013 04:58:45 +1100 (EST) 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=il2PyIx3JbWX2/jIwuleFpe07fjiz5UXd70TeDbVXph 94Fyfv3X2lsfz7fseObpA9lk3O6DDqE3oKvsE1tJDXTZvEBgsNv43CP7Et38HSrk EEUoAdS1BYu0AdqaXw3AS4buTIh8p6fuLYQEqpQsCakQVj8ZkmANXK4Bh9SvnMC4 = 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=gpDepBUucjfqDlL9D2tE+SxVR/k=; b=A5U745F433bweuCQt DKEIO1O05uqmOxa5IfBkecdGMDs5T+mrVa1gfhNqx1b+UF6GfnsTmSO3H6V640gd mYmD6FoAvLR5t5JZ+R8kMZ4vwHRqfVS021SGQocKxwrBkt2KdV8cEG0d3o7MWu1H GKLaqu84MNHy135W2e+P5l+2hY= Received: (qmail 10670 invoked by alias); 15 Oct 2013 17:58:39 -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 10658 invoked by uid 89); 15 Oct 2013 17:58:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f169.google.com Received: from mail-ie0-f169.google.com (HELO mail-ie0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 15 Oct 2013 17:58:37 +0000 Received: by mail-ie0-f169.google.com with SMTP id ar20so6311544iec.28 for ; Tue, 15 Oct 2013 10:58:35 -0700 (PDT) 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=uZKSX/R0aHYAMG2wYPmzPxH+fPQ9bhEzjeCsgV5GacE=; b=mfT43yb8OMGQX3yQmnRZV29gLRqKYT+W0j2u6e0e8V5umCokZGQXKX9Ruso2MO/Lih yTa0+WZJeUzeA0qqz5o7qXBGaw1HLAoj9Gcg9e17tb1v/UkKlCfW+Ee9/cWlU036UxPS Fwn7MQ0597nrBP25Xkw3J28mgkzTNrG8iRmLW4GK1ivVn4SaECMvxHeURBq9VC4ZPtQa yAROJFMEv8z1MejnOjKzsJ359fUoleBXLnZDPFi29yM7R0GnXx1VxCTX8m4wJL0bFyFP vVi8Z+r8cJgjHO3Ymry95Cd9aKtxEs8jmeWq0C4h8JRReUQNaTg17++fRU1MlloUCXVD jrqw== X-Gm-Message-State: ALoCoQnHR7JQrOqr/HX5g/7fCvmyKL2ciLIbxlEILvA9SEVmy193y6bCjoMuAdh8RJCkYbJ/tyNERrORKix9nIjEuo423m+7axWhvUlR3S7vMAT3XClr5onCgguXwa1Rdahppv1/hRfd5gmqetvNA9wa3CBRLLZkr7FiNPPx9D8zmkLz9nDXMHrycJMZlZ89/qVRO8X1TD0nx8jF4yX4Vtbq24uhJ/V0bw== MIME-Version: 1.0 X-Received: by 10.50.111.228 with SMTP id il4mr3279204igb.1.1381859915623; Tue, 15 Oct 2013 10:58:35 -0700 (PDT) Received: by 10.64.9.133 with HTTP; Tue, 15 Oct 2013 10:58:35 -0700 (PDT) Date: Tue, 15 Oct 2013 10:58:35 -0700 Message-ID: Subject: [GOOGLE] Add flag to enalbe AutoFDO accurate mode From: Dehao Chen To: GCC Patches Cc: David Li X-IsSubscribed: yes This patch add a new flag to let user to tell compiler that the AutoFDO profile is accurate. So the compiler will assume function without any sample is UNLIKELY_EXECUTED. This could save 10%~20% text section size. Bootstrapped and passed regression test. OK for google-4_8 branch? Thanks, Dehao else if (lookup_attribute ("hot", DECL_ATTRIBUTES (current_function_decl)) Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 203546) +++ gcc/common.opt (working copy) @@ -942,6 +942,10 @@ Common Joined RejectNegative Var(auto_profile_file Use sample profile information for call graph node weights. The profile file is specified in the argument. +fauto-profile-accurate +Common Report Var(flag_auto_profile_accurate) Optimization +Whether to assume the sample profile is accurate. + ; -fcheck-bounds causes gcc to generate array bounds checks. ; For C, C++ and ObjC: defaults off. ; For Java: defaults to on. Index: gcc/predict.c =================================================================== --- gcc/predict.c (revision 203546) +++ gcc/predict.c (working copy) @@ -2866,7 +2866,9 @@ compute_function_frequency (void) || (flag_auto_profile && profile_status == PROFILE_GUESSED)) { int flags = flags_from_decl_or_type (current_function_decl); - if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl)) + if (profile_info && flag_auto_profile_accurate) + node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; + else if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl)) != NULL) node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;