Hi,
this patch moves call of report_predictor_hitrates after fake edges are removed 
because
those affects post dominance and consequently the prediction placement.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

        * profile.c (compute_branch_probabilities): Do not report hitrates
        here.
        (branch_prob): Report hitrates here.
        * predict.c (gimple_predict_edge): Do not assert profile status;
        fix formatting issues.
Index: profile.c
===================================================================
--- profile.c   (revision 236815)
+++ profile.c   (working copy)
@@ -845,8 +845,6 @@ compute_branch_probabilities (unsigned c
       fputc ('\n', dump_file);
       fputc ('\n', dump_file);
     }
-  if (dump_file && (dump_flags & TDF_DETAILS))
-    report_predictor_hitrates ();
 
   free_aux_for_blocks ();
 }
@@ -1331,6 +1329,8 @@ branch_prob (void)
   values.release ();
   free_edge_list (el);
   coverage_end_function (lineno_checksum, cfg_checksum);
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    report_predictor_hitrates ();
 }
 
 /* Union find algorithm implementation for the basic blocks using
Index: predict.c
===================================================================
--- predict.c   (revision 236848)
+++ predict.c   (working copy)
@@ -593,10 +593,10 @@ rtl_predict_edge (edge e, enum br_predic
 void
 gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
 {
-  gcc_assert (profile_status_for_fn (cfun) != PROFILE_GUESSED);
-  if ((e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && EDGE_COUNT (e->src->succs) >
-       1)
-      && flag_guess_branch_prob && optimize)
+  if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)
+      && EDGE_COUNT (e->src->succs) > 1
+      && flag_guess_branch_prob
+      && optimize)
     {
       struct edge_prediction *i = XNEW (struct edge_prediction);
       edge_prediction *&preds = bb_predictions->get_or_insert (e->src);

Reply via email to