This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve probability/profile distribution in ORIF expansion


> 2013-10-01  Teresa Johnson  <tejohnson@google.com>
> 
>         * dojump.c (do_jump_1): Divide probability between
>         both conditions of a TRUTH_ORIF_EXPR.
> 
> +      {
> +        /* Spread the probability evenly between the two conditions. So
> +           the first condition has half the total probability of being true.
> +           The second condition has the other half of the total probability,
> +           so its jump has a probability of half the total, relative to
> +           the probability we reached it (i.e. the first condition
> was false).  */
> +        int op0_prob = prob / 2;
> +        int op1_prob = GCOV_COMPUTE_SCALE ((prob / 2), inv (op0_prob));

Documentation of the functions says that PROB may be -1 when it is unknown, In that
case you want to arrange op0_prob=op1_prob = -1.

What about TRUTH_ANDIF_EXPR code above?  I think it needs similar adjusting

Patch is preaproved with these changes.

Thanks!
Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]