aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2012-11-23 08:49:43 +0000
committerJan Hubicka <hubicka@gcc.gnu.org>2012-11-23 08:49:43 +0000
commitb131b583978ceadbe54325be3a09710a48481df2 (patch)
treec3a33c43f2e5098a3927078c4b315cd7408551cc /gcc/predict.c
parent3409d40e47ed30f1b6dca3fa074c4094efbf5b50 (diff)
downloadgcc-b131b583978ceadbe54325be3a09710a48481df2.zip
gcc-b131b583978ceadbe54325be3a09710a48481df2.tar.gz
gcc-b131b583978ceadbe54325be3a09710a48481df2.tar.bz2
predict.c (maybe_hot_count_p): Use threshold from profiled working set instead of hard limit.
* predict.c (maybe_hot_count_p): Use threshold from profiled working set instead of hard limit. (cgraph_maybe_hot_edge_p): Invoke maybe_hot_count_p() instead of directly checking limit. * params.def (HOT_BB_COUNT_FRACTION): Remove. (HOT_BB_COUNT_WS_PERMILLE): New parameter. * invoke.texi (hot-bb-count-fraction): Remove. (hot-bb-count-ws-permille): Document. Co-Authored-By: Jan Hubicka <jh@suse.cz> From-SVN: r193747
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index aceca1d..5d3de29 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -134,13 +134,20 @@ maybe_hot_frequency_p (struct function *fun, int freq)
static inline bool
maybe_hot_count_p (struct function *fun, gcov_type count)
{
- if (profile_status_for_function (fun) != PROFILE_READ)
+ gcov_working_set_t *ws;
+ static gcov_type min_count = -1;
+ if (fun && profile_status_for_function (fun) != PROFILE_READ)
return true;
/* Code executed at most once is not hot. */
if (profile_info->runs >= count)
return false;
- return (count
- > profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION));
+ if (min_count == -1)
+ {
+ ws = find_working_set (PARAM_VALUE (HOT_BB_COUNT_WS_PERMILLE));
+ gcc_assert (ws);
+ min_count = ws->min_counter;
+ }
+ return (count >= min_count);
}
/* Return true in case BB can be CPU intensive and should be optimized
@@ -161,8 +168,8 @@ bool
cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
{
if (profile_info && flag_branch_probabilities
- && (edge->count
- <= profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
+ && !maybe_hot_count_p (NULL,
+ edge->count))
return false;
if (edge->caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
|| (edge->callee