https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #5 from Siddhesh Poyarekar <siddhesh at gotplt dot org> ---
This fixes the problem for me.  freq_max < 1, i.e. freq_max of one of the bbs
in the function means that it ends up having a profile count larger than 2^30
since the freq_max gets reset to 16.  Dropping this reset makes sure that the
profile counts are always correctly normalized to real_bb_freq_max:

diff --git a/gcc/predict.c b/gcc/predict.c
index 0f34956..ff9b5a9 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3613,8 +3613,6 @@ estimate_bb_frequencies (bool force)
          freq_max = BLOCK_INFO (bb)->frequency;

       freq_max = real_bb_freq_max / freq_max;
-      if (freq_max < 16)
-       freq_max = 16;
       profile_count ipa_count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa ();
       cfun->cfg->count_max = profile_count::uninitialized ();
       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)

Reply via email to