===================================================================
@@ -325,18 +325,27 @@ do_jump_1 (enum tree_code code, tree op0, tree op1
break;
case TRUTH_ORIF_EXPR:
- if (if_true_label == NULL_RTX)
- {
- drop_through_label = gen_label_rtx ();
- do_jump (op0, NULL_RTX, drop_through_label, prob);
- do_jump (op1, if_false_label, NULL_RTX, prob);
- }
- else
- {
- do_jump (op0, NULL_RTX, if_true_label, prob);
- do_jump (op1, if_false_label, if_true_label, prob);
- }
- break;
+ {
+ /* 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));
+ if (if_true_label == NULL_RTX)
+ {
+ drop_through_label = gen_label_rtx ();
+ do_jump (op0, NULL_RTX, drop_through_label, op0_prob);
+ do_jump (op1, if_false_label, NULL_RTX, op1_prob);
+ }
+ else
+ {
+ do_jump (op0, NULL_RTX, if_true_label, op0_prob);
+ do_jump (op1, if_false_label, if_true_label, op1_prob);
+ }
+ break;
+ }
default: