diff options
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index e39766c..5e2e77a 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -774,7 +774,8 @@ split_edge_and_insert (edge e, rtx_insn *insns) static rtx_insn * compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, - rtx_code_label *label, int prob, rtx_insn *cinsn) + rtx_code_label *label, profile_probability prob, + rtx_insn *cinsn) { rtx_insn *seq; rtx_jump_insn *jump; @@ -808,12 +809,14 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, op0 = force_operand (op0, NULL_RTX); op1 = force_operand (op1, NULL_RTX); do_compare_rtx_and_jump (op0, op1, comp, 0, - mode, NULL_RTX, NULL, label, -1); + mode, NULL_RTX, NULL, label, + profile_probability::uninitialized ()); jump = as_a <rtx_jump_insn *> (get_last_insn ()); jump->set_jump_target (label); LABEL_NUSES (label)++; } - add_int_reg_note (jump, REG_BR_PROB, prob); + if (prob.initialized_p ()) + add_int_reg_note (jump, REG_BR_PROB, prob.to_reg_br_prob_base ()); seq = get_insns (); end_sequence (); @@ -857,7 +860,8 @@ unroll_loop_runtime_iterations (struct loop *loop) { rtx old_niter, niter, tmp; rtx_insn *init_code, *branch_code; - unsigned i, j, p; + unsigned i, j; + profile_probability p; basic_block preheader, *body, swtch, ezc_swtch = NULL; int may_exit_copy, iter_freq, new_freq; profile_count iter_count, new_count; @@ -989,7 +993,7 @@ unroll_loop_runtime_iterations (struct loop *loop) /* Create item for switch. */ j = n_peel - i - (extra_zero_check ? 0 : 1); - p = REG_BR_PROB_BASE / (i + 2); + p = profile_probability::always ().apply_scale (1, i + 2); preheader = split_edge (loop_preheader_edge (loop)); /* Add in frequency/count of edge from switch block. */ @@ -1006,7 +1010,7 @@ unroll_loop_runtime_iterations (struct loop *loop) swtch = split_edge_and_insert (single_pred_edge (swtch), branch_code); set_immediate_dominator (CDI_DOMINATORS, preheader, swtch); - single_succ_edge (swtch)->probability = REG_BR_PROB_BASE - p; + single_succ_edge (swtch)->probability = p.invert (); single_succ_edge (swtch)->count = new_count; new_freq += iter_freq; new_count += iter_count; @@ -1021,7 +1025,7 @@ unroll_loop_runtime_iterations (struct loop *loop) if (extra_zero_check) { /* Add branch for zero iterations. */ - p = REG_BR_PROB_BASE / (max_unroll + 1); + p = profile_probability::always ().apply_scale (1, max_unroll + 1); swtch = ezc_swtch; preheader = split_edge (loop_preheader_edge (loop)); /* Recompute frequency/count adjustments since initial peel copy may @@ -1039,7 +1043,7 @@ unroll_loop_runtime_iterations (struct loop *loop) swtch = split_edge_and_insert (single_succ_edge (swtch), branch_code); set_immediate_dominator (CDI_DOMINATORS, preheader, swtch); - single_succ_edge (swtch)->probability = REG_BR_PROB_BASE - p; + single_succ_edge (swtch)->probability = p.invert (); single_succ_edge (swtch)->count -= iter_count; e = make_edge (swtch, preheader, single_succ_edge (swtch)->flags & EDGE_IRREDUCIBLE_LOOP); |