summaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authordehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-21 17:59:30 +0000
committerdehao <dehao@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-21 17:59:30 +0000
commit94bed7c33d801ea3b1fb6b10ff395af74a98244e (patch)
tree2dca135cb3eadb5a684bff2c9f64afbafd4ba80e /gcc/predict.c
parent415309e2ead97ad7cfed19baeb1ea9eb20b05756 (diff)
downloadgcc-94bed7c33d801ea3b1fb6b10ff395af74a98244e.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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 5f5d4a55c9c..96c7661aebe 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -167,7 +167,7 @@ set_hot_bb_threshold (gcov_type min)
/* Return TRUE if frequency FREQ is considered to be hot. */
-static inline bool
+bool
maybe_hot_count_p (struct function *fun, gcov_type count)
{
if (fun && profile_status_for_fn (fun) != PROFILE_READ)
@@ -2859,7 +2859,7 @@ counts_to_freqs (void)
/* Don't overwrite the estimated frequencies when the profile for
the function is missing. We may drop this function PROFILE_GUESSED
later in drop_profile (). */
- if (!ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)
+ if (!flag_auto_profile && !ENTRY_BLOCK_PTR_FOR_FN (cfun)->count)
return 0;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
@@ -3230,7 +3230,8 @@ rebuild_frequencies (void)
count_max = MAX (bb->count, count_max);
if (profile_status_for_fn (cfun) == PROFILE_GUESSED
- || (profile_status_for_fn (cfun) == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
+ || (!flag_auto_profile && profile_status_for_fn (cfun) == PROFILE_READ
+ && count_max < REG_BR_PROB_BASE/10))
{
loop_optimizer_init (0);
add_noreturn_fake_exit_edges ();