===================================================================
@@ -9307,9 +9307,9 @@ ftree-vect-loop-version for more information.
The maximum number of iterations of a loop the brute force algorithm
for analysis of # of iterations of the loop tries to evaluate.
-@item hot-bb-count-fraction
-Select fraction of the maximal count of repetitions of basic block in program
-given basic block needs to have to be considered hot.
+@item hot-bb-count-ws-permille
+A basic block profile count is considered hot if it contributes to
+the given permillage (i.e. 0...1000) of the entire profiled execution.
@item hot-bb-frequency-fraction
Select fraction of the entry block frequency of executions of basic block in
===================================================================
@@ -137,13 +137,20 @@ maybe_hot_frequency_p (int freq)
bool
maybe_hot_count_p (gcov_type count)
{
+ gcov_working_set_t *ws = NULL;
+ static gcov_type min_count = -1;
if (!profile_info)
return false;
/* 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
@@ -163,8 +170,7 @@ 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 (edge->count))
return false;
if (edge->caller->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
|| edge->callee->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)
===================================================================
@@ -424,10 +424,11 @@ DEFPARAM(PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD,
"A threshold on the average loop count considered by the swing modulo scheduler",
0, 0, 0)
-DEFPARAM(HOT_BB_COUNT_FRACTION,
- "hot-bb-count-fraction",
- "Select fraction of the maximal count of repetitions of basic block in program given basic block needs to have to be considered hot",
- 60000, 0, 0)
+DEFPARAM(HOT_BB_COUNT_WS_PERMILLE,
+ "hot-bb-count-ws-permille",
+ "A basic block profile count is considered hot if it contributes to "
+ "the given permillage of the entire profiled execution",
+ 999, 0, 1000)
DEFPARAM(HOT_BB_FREQUENCY_FRACTION,
"hot-bb-frequency-fraction",
"Select fraction of the maximal frequency of executions of basic block in function given basic block needs to have to be considered hot",
@@ -451,7 +452,7 @@ DEFPARAM (PARAM_ALIGN_LOOP_ITERATIONS,
flatten the profile.
We need to cut the maximal predicted iterations to large enough iterations
- so the loop appears important, but safely within HOT_BB_COUNT_FRACTION
+ so the loop appears important, but safely within maximum hotness
range. */
DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS,