Hi,
this is one of two remiaing places we scale by integer ratios rather than
counts which lose quality info.  This is because we scale up here which is
technically bad idea we lose precision and all code duplication should
perform scale at once as last step to avoid cumulating mistakes.

Bot since the updating logic is quite tricky, i decided to simply rewrite
scaling to counts for now.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

        * tree-vect-loop-manip.c (vect_do_peeling): Do not use
        scale_bbs_frequencies_int.
Index: tree-vect-loop-manip.c
===================================================================
--- tree-vect-loop-manip.c      (revision 254767)
+++ tree-vect-loop-manip.c      (working copy)
@@ -1844,14 +1844,16 @@ vect_do_peeling (loop_vec_info loop_vinf
          /* Simply propagate profile info from guard_bb to guard_to which is
             a merge point of control flow.  */
          guard_to->count = guard_bb->count;
+
          /* Scale probability of epilog loop back.
             FIXME: We should avoid scaling down and back up.  Profile may
             get lost if we scale down to 0.  */
-         int scale_up = REG_BR_PROB_BASE * REG_BR_PROB_BASE
-                        / prob_vector.to_reg_br_prob_base ();
          basic_block *bbs = get_loop_body (epilog);
-         scale_bbs_frequencies_int (bbs, epilog->num_nodes, scale_up,
-                                    REG_BR_PROB_BASE);
+         for (unsigned int i = 0; i < epilog->num_nodes; i++)
+           bbs[i]->count = bbs[i]->count.apply_scale
+                                (bbs[i]->count,
+                                 bbs[i]->count.apply_probability
+                                   (prob_vector));
          free (bbs);
        }
 

Reply via email to