diff options
author | Dehao Chen <dehao@google.com> | 2014-10-21 17:59:30 +0000 |
---|---|---|
committer | Dehao Chen <dehao@gcc.gnu.org> | 2014-10-21 17:59:30 +0000 |
commit | be3c16c474629e69c6c4cd6465ffa4b572cc6460 (patch) | |
tree | 2dca135cb3eadb5a684bff2c9f64afbafd4ba80e /gcc/doc/invoke.texi | |
parent | 3edf64aa919b9bf725672bd0ad91bfd30c6a31df (diff) | |
download | gcc-be3c16c474629e69c6c4cd6465ffa4b572cc6460.tar.gz |
Add AutoFDO.
gcc/ChangeLog:
2014-10-21 Dehao Chen <dehao@google.com>
* auto-profile.c: New file.
* auto-profile.h: New file.
* basic-block.h (maybe_hot_count_p): New export func.
(add_working_set): New export func.
* gcov-io.h (GCOV_TAG_AFDO_FILE_NAMES): New tag.
(GCOV_TAG_AFDO_FUNCTION): Likewise.
(GCOV_TAG_AFDO_WORKING_SET): Likewise.
* opts.c (enable_fdo_optimizations): New func.
(common_handle_option): Handle -fauto-profile flag.
* ipa-inline.c (want_early_inline_function_p): Iterative-einline.
(class pass_early_inline): Export early_inliner.
(early_inliner): Likewise.
(pass_early_inline::execute): Likewise.
* ipa-inline.h (early_inliner): Likewise.
* predict.c (maybe_hot_count_p): New export func.
(counts_to_freqs): AutoFDO logic.
(rebuild_frequencies): Likewise.
* tree-profile.c (pass_ipa_tree_profile::gate): Likewise.
* profile.c (add_working_set): New func.
* Makefile.in (auto-profile.o): New object file.
* passes.def (pass_ipa_auto_profile): New pass.
* tree-ssa-live.c (remove_unused_scope_block_p): AutoFDO logic.
* tree-pass.h (make_pass_ipa_auto_profile): New pass.
* toplev.c (compile_file): AutoFDO logic.
* doc/invoke.texi (-fauto-profile): New doc.
* coverage.c (coverage_init): AutoFDO logic.
* common.opt (-fauto-profile): New flag.
* timevar.def (TV_IPA_AUTOFDO): New tag.
* value-prof.c (gimple_alloc_histogram_value): New export func.
(check_ic_target): Likewise.
* value-prof.h (gimple_alloc_histogram_value): Likewise.
(check_ic_target): Likewise.
From-SVN: r216523
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r-- | gcc/doc/invoke.texi | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 23f272f4a1f..0b26976c520 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -365,7 +365,8 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol -falign-jumps[=@var{n}] @gol -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol --fassociative-math -fauto-inc-dec -fbranch-probabilities @gol +-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol +-fauto-inc-dec -fbranch-probabilities @gol -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol -fbtr-bb-exclusive -fcaller-saves @gol -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol @@ -9205,6 +9206,41 @@ code. If @var{path} is specified, GCC looks at the @var{path} to find the profile feedback data files. See @option{-fprofile-dir}. + +@item -fauto-profile +@itemx -fauto-profile=@var{path} +@opindex fauto-profile +Enable sampling based feedback directed optimizations, and optimizations +generally profitable only with profile feedback available. + +The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, +@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize}, +@code{-finline-functions}, @code{-fipa-cp}, @code{-fipa-cp-clone}, +@code{-fpredictive-commoning}, @code{-funswitch-loops}, +@code{-fgcse-after-reload}, @code{-ftree-loop-distribute-patterns}, + +If @var{path} is specified, GCC looks at the @var{path} to find +the profile feedback data files. + +In order to collect AutoFDO profile, you need to have: + +1. A linux system with linux perf support +2. (optional) An Intel processor with last branch record (LBR) support. This is + to guarantee accurate instruction level profile, which is important for + AutoFDO performance. + +To collect the profile, first use linux perf to collect raw profile +(see @uref{https://perf.wiki.kernel.org/}). + +E.g. +@code{perf record -e br_inst_retired:near_taken -b -o perf.data -- your_program} + +Then use create_gcov tool, which takes raw profile and unstripped binary to +generate AutoFDO profile that can be used by GCC. +(see @uref{https://github.com/google/autofdo}). + +E.g. +@code{create_gcov --binary=your_program.unstripped --profile=perf.data --gcov=profile.afdo} @end table The following options control compiler behavior regarding floating-point |