diff options
author | Rong Xu <xur@google.com> | 2014-07-21 16:47:22 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-07-29 15:31:03 -0700 |
commit | 38a8aecfb882072900434499696b5c32a2274515 (patch) | |
tree | 2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/predict.c | |
parent | c231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff) | |
download | toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2 toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip |
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch.
We also cherry-picked r213062, r213063 and r213064 to fix windows
build issues.
All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9.
The following prior commits has not been merged to google branch yet.
(They are included in this commit).
e7af147f979e657fe2df00808e5b4319b0e088c6,
baf87df3cb2683649ba7e9872362a7e721117c23, and
c231900e5dcc14d8296bd9f62b45997a49d4d5e7.
Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/predict.c')
-rw-r--r-- | gcc-4.9/gcc/predict.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc-4.9/gcc/predict.c b/gcc-4.9/gcc/predict.c index 249433f91..ecf3f73ba 100644 --- a/gcc-4.9/gcc/predict.c +++ b/gcc-4.9/gcc/predict.c @@ -161,11 +161,13 @@ 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) return true; + if (!profile_info) + return false; /* Code executed at most once is not hot. */ if (profile_info->runs >= count) return false; @@ -1033,6 +1035,12 @@ combine_predictions_for_bb (basic_block bb) { first->probability = combined_probability; second->probability = REG_BR_PROB_BASE - combined_probability; + if (flag_check_branch_annotation && first_match && + best_predictor == PRED_BUILTIN_EXPECT) + { + first->flags |= EDGE_PREDICTED_BY_EXPECT; + second->flags |= EDGE_PREDICTED_BY_EXPECT; + } } } @@ -2955,7 +2963,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) @@ -3094,10 +3102,14 @@ compute_function_frequency (void) if (DECL_STATIC_DESTRUCTOR (current_function_decl)) node->only_called_at_exit = true; - if (profile_status_for_fn (cfun) != PROFILE_READ) + if (profile_status_for_fn (cfun) != PROFILE_READ + || (flag_auto_profile + && profile_status_for_fn (cfun) == 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; else if (lookup_attribute ("hot", DECL_ATTRIBUTES (current_function_decl)) @@ -3254,7 +3266,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 (); |