From patchwork Sat Nov 17 01:01:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 999221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490355-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="XjDV5uOx"; dkim-atps=neutral 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 42xcJ65WnRz9s3C for ; Sat, 17 Nov 2018 12:01:57 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=W7kr9o0jpzeQ4bYkK/BMmh0xwBDkwUMS4Bvi2kqPG7WLxGCu+e 3+Bn8QF1WtoapXRx31DVFmFCH3pPcs1qDNze1WL6NtGFRYve9YiOUymT/xwR2kEs StJAyOT2sw8Om+HLfXQsk7CQ5YFBCBAvdKRczdF0wis6+/wBHz1PogrQE= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=AF7LPNv3xRzSg2c6q6bnTGI2Q0Q=; b=XjDV5uOxjhKgzUOWb0CQ bTICrTj+cQpaaR0Au3Ib3GqHZXKF93DY8btzwX0rc1RsBKutjBtG79hREHnGsyIt DjKVeOKE9FmAvkOJr7EpdyRJVgL4Og+MDT2XBL7Ho87VYrbwgi32pt2lE/5n8dJR z/XE6YxrasO4MQGHZYzV3ko= Received: (qmail 20620 invoked by alias); 17 Nov 2018 01:01:49 -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 20583 invoked by uid 89); 17 Nov 2018 01:01:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=smooth, roll, duplicates, op X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Nov 2018 01:01:45 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gNozX-0001KS-Ca from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Fri, 16 Nov 2018 17:01:43 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 16 Nov 2018 17:01:40 -0800 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [doc, committed] update options enabled by -fprofile-generate, -fprofile-use, -fauto-profile Message-ID: Date: Fri, 16 Nov 2018 18:01:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 This patch is for PR23197, a complaint dating back to 2005 that the documentation for the options enabled by -fprofile-generate and -fprofile-use was bit-rotten. Well, it was even more bit-rotten by now. :-P I updated the docs to reflect the current code in opts.c and also fixed -fauto-profile, which shares much of the same logic. -Sandra Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 266229) +++ gcc/doc/invoke.texi (working copy) @@ -8412,7 +8412,8 @@ If all calls to a given function are int declared @code{static}, then the function is normally not output as assembler code in its own right. -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. +Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled +by @option{-fprofile-use} and @option{-fauto-profile}. @item -finline-functions-called-once @opindex finline-functions-called-once @@ -8671,6 +8672,8 @@ When @option{-fgcse-after-reload} is ena pass is performed after reload. The purpose of this pass is to clean up redundant spilling. +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. + @item -faggressive-loop-optimizations @opindex faggressive-loop-optimizations This option tells the loop optimizer to use language constraints to @@ -9241,6 +9244,7 @@ to functions are constants and then opti This optimization can substantially increase performance if the application has constants passed to functions. This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. +It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. @item -fipa-cp-clone @opindex fipa-cp-clone @@ -9251,12 +9255,14 @@ Because this optimization can create mul it may significantly increase code size (see @option{--param ipcp-unit-growth=@var{value}}). This flag is enabled by default at @option{-O3}. +It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. @item -fipa-bit-cp @opindex fipa-bit-cp When enabled, perform interprocedural bitwise constant -propagation. This flag is enabled by default at @option{-O2}. It -requires that @option{-fipa-cp} is enabled. +propagation. This flag is enabled by default at @option{-O2} and +by @option{-fprofile-use} and @option{-fauto-profile}. +It requires that @option{-fipa-cp} is enabled. @item -fipa-vrp @opindex fipa-vrp @@ -9455,7 +9461,8 @@ ENDDO @item -ftree-loop-distribute-patterns @opindex ftree-loop-distribute-patterns Perform loop distribution of patterns that can be code generated with -calls to a library. This flag is enabled by default at @option{-O3}. +calls to a library. This flag is enabled by default at @option{-O3}, and +by @option{-fprofile-use} and @option{-fauto-profile}. This pass distributes the initialization loops and generates a call to memset zero. For example, the loop @@ -9584,12 +9591,14 @@ and @option{-ftree-slp-vectorize} if not @item -ftree-loop-vectorize @opindex ftree-loop-vectorize Perform loop vectorization on trees. This flag is enabled by default at -@option{-O3} and when @option{-ftree-vectorize} is enabled. +@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, +and @option{-fauto-profile}. @item -ftree-slp-vectorize @opindex ftree-slp-vectorize Perform basic block vectorization on trees. This flag is enabled by default at -@option{-O3} and when @option{-ftree-vectorize} is enabled. +@option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use}, +and @option{-fauto-profile}. @item -fvect-cost-model=@var{model} @opindex fvect-cost-model @@ -9663,6 +9672,7 @@ Perform predictive commoning optimizatio iterations of loops. This option is enabled at level @option{-O3}. +It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}. @item -fprefetch-loop-arrays @opindex fprefetch-loop-arrays @@ -10276,15 +10286,22 @@ be inconsistent due to missed counter up GCC uses heuristics to correct or smooth out such inconsistencies. By default, GCC emits an error message when an inconsistent profile is detected. +This option is enabled by @option{-fauto-profile}. + @item -fprofile-use @itemx -fprofile-use=@var{path} @opindex fprofile-use Enable profile feedback-directed optimizations, -and the following optimizations -which are generally profitable only with profile feedback available: -@option{-fbranch-probabilities}, @option{-fvpt}, -@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, -@option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}. +and the following optimizations, many of which +are generally profitable only with profile feedback available: + +@gccoptlist{-fbranch-probabilities -fprofile-values @gol +-funroll-loops -fpeel-loops -ftracer -fvpt @gol +-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol +-fpredictive-commoning -fsplit-loops -funswitch-loops @gol +-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol +-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol +-fprofile-reorder-functions} Before you can use this option, you must first generate profiling information. @xref{Instrumentation Options}, for information about the @@ -10294,7 +10311,7 @@ By default, GCC emits an error message i match the source code. This error can be turned into a warning by using @option{-Wno-error=coverage-mismatch}. Note this may result in poorly optimized code. Additionally, by default, GCC also emits a warning message if -the feedback profiles do not exist (See @option{-Wmissing-profile}). +the feedback profiles do not exist (see @option{-Wmissing-profile}). If @var{path} is specified, GCC looks at the @var{path} to find the profile feedback data files. See @option{-fprofile-dir}. @@ -10303,14 +10320,16 @@ the profile feedback data files. See @op @itemx -fauto-profile=@var{path} @opindex fauto-profile Enable sampling-based feedback-directed optimizations, -and the following optimizations -which are generally profitable only with profile feedback available: -@option{-fbranch-probabilities}, @option{-fvpt}, -@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, -@option{-ftree-vectorize}, -@option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone}, -@option{-fpredictive-commoning}, @option{-funswitch-loops}, -@option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}. +and the following optimizations, +many of which are generally profitable only with profile feedback available: + +@gccoptlist{-fbranch-probabilities -fprofile-values @gol +-funroll-loops -fpeel-loops -ftracer -fvpt @gol +-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol +-fpredictive-commoning -fsplit-loops -funswitch-loops @gol +-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol +-fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol +-fprofile-correction} @var{path} is the name of a file containing AutoFDO profile information. If omitted, it defaults to @file{fbdata.afdo} in the current directory. @@ -10613,6 +10632,8 @@ used in one place: in @file{reorg.c}, in branch is most likely to take, the @samp{REG_BR_PROB} values are used to exactly determine which path is taken more often. +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. + @item -fprofile-values @opindex fprofile-values If combined with @option{-fprofile-arcs}, it adds code so that some @@ -10621,7 +10642,8 @@ data about values of expressions in the With @option{-fbranch-probabilities}, it reads back the data gathered from profiling values of expressions for usage in optimizations. -Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. +Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and +@option{-fauto-profile}. @item -fprofile-reorder-functions @opindex fprofile-reorder-functions @@ -10641,6 +10663,8 @@ and actually performs the optimizations Currently the optimizations include specialization of division operations using the knowledge about the value of the denominator. +Enabled with @option{-fprofile-use} and @option{-fauto-profile}. + @item -frename-registers @opindex frename-registers Attempt to avoid false dependencies in scheduled code by making use @@ -10666,7 +10690,7 @@ Perform tail duplication to enlarge supe simplifies the control flow of the function allowing other optimizations to do a better job. -Enabled with @option{-fprofile-use}. +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. @item -funroll-loops @opindex funroll-loops @@ -10677,7 +10701,7 @@ It also turns on complete loop peeling ( a small constant number of iterations). This option makes code larger, and may or may not make it run faster. -Enabled with @option{-fprofile-use}. +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. @item -funroll-all-loops @opindex funroll-all-loops @@ -10693,7 +10717,7 @@ roll much (from profile feedback or stat complete loop peeling (i.e.@: complete removal of loops with small constant number of iterations). -Enabled with @option{-O3} and/or @option{-fprofile-use}. +Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}. @item -fmove-loop-invariants @opindex fmove-loop-invariants @@ -10705,11 +10729,15 @@ at level @option{-O1} and higher, except Split a loop into two if it contains a condition that's always true for one side of the iteration space and false for the other. +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. + @item -funswitch-loops @opindex funswitch-loops Move branches with loop invariant conditions out of the loop, with duplicates of the loop on both branches (modified according to result of the condition). +Enabled by @option{-fprofile-use} and @option{-fauto-profile}. + @item -ffunction-sections @itemx -fdata-sections @opindex ffunction-sections @@ -12096,7 +12124,9 @@ profile useful for later recompilation w optimization. You must use @option{-fprofile-generate} both when compiling and when linking your program. -The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}. +The following options are enabled: +@option{-fprofile-arcs}, @option{-fprofile-values}, +@option{-finline-functions}, and @option{-fipa-bit-cp}. If @var{path} is specified, GCC looks at the @var{path} to find the profile feedback data files. See @option{-fprofile-dir}.