From 9f55aee9dca759da84afd4563ff72d3ca8ab8a1c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 25 Jan 2022 19:16:06 +0100 Subject: Add operators / and * for profile_{count,probability}. gcc/ChangeLog: * bb-reorder.cc (find_traces_1_round): Add operators / and * and use them. (better_edge_p): Likewise. * cfgloop.cc (find_subloop_latch_edge_by_profile): Likewise. * cfgloopmanip.cc (scale_loop_profile): Likewise. * cfgrtl.cc (force_nonfallthru_and_redirect): Likewise. * cgraph.cc (cgraph_edge::maybe_hot_p): Likewise. * config/sh/sh.cc (expand_cbranchdi4): Likewise. * dojump.cc (do_compare_rtx_and_jump): Likewise. * final.cc (compute_alignments): Likewise. * ipa-cp.cc (update_counts_for_self_gen_clones): Likewise. (decide_about_value): Likewise. * ipa-inline-analysis.cc (do_estimate_edge_time): Likewise. * loop-unroll.cc (unroll_loop_runtime_iterations): Likewise. * modulo-sched.cc (sms_schedule): Likewise. * omp-expand.cc (extract_omp_for_update_vars): Likewise. (expand_omp_ordered_sink): Likewise. (expand_omp_for_ordered_loops): Likewise. (expand_omp_for_static_nochunk): Likewise. * predict.cc (maybe_hot_count_p): Likewise. (probably_never_executed): Likewise. (set_even_probabilities): Likewise. (handle_missing_profiles): Likewise. (expensive_function_p): Likewise. * profile-count.h: Likewise. * profile.cc (compute_branch_probabilities): Likewise. * stmt.cc (emit_case_dispatch_table): Likewise. * symtab-thunks.cc (expand_thunk): Likewise. * tree-ssa-loop-manip.cc (tree_transform_and_unroll_loop): Likewise. * tree-ssa-sink.cc (select_best_block): Likewise. * tree-switch-conversion.cc (switch_decision_tree::analyze_switch_statement): Likewise. (switch_decision_tree::balance_case_nodes): Likewise. (switch_decision_tree::emit_case_nodes): Likewise. * tree-vect-loop.cc (scale_profile_for_vect_loop): Likewise. --- gcc/final.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'gcc/final.cc') diff --git a/gcc/final.cc b/gcc/final.cc index a986886..c5427d2 100644 --- a/gcc/final.cc +++ b/gcc/final.cc @@ -642,8 +642,7 @@ compute_alignments (void) flow_loops_dump (dump_file, NULL, 1); } loop_optimizer_init (AVOID_CFG_MODIFICATIONS); - profile_count count_threshold = cfun->cfg->count_max.apply_scale - (1, param_align_threshold); + profile_count count_threshold = cfun->cfg->count_max / param_align_threshold; if (dump_file) { @@ -710,10 +709,9 @@ compute_alignments (void) if (!has_fallthru && (branch_count > count_threshold - || (bb->count > bb->prev_bb->count.apply_scale (10, 1) + || (bb->count > bb->prev_bb->count * 10 && (bb->prev_bb->count - <= ENTRY_BLOCK_PTR_FOR_FN (cfun) - ->count.apply_scale (1, 2))))) + <= ENTRY_BLOCK_PTR_FOR_FN (cfun)->count / 2)))) { align_flags alignment = JUMP_ALIGN (label); if (dump_file) @@ -727,9 +725,7 @@ compute_alignments (void) && single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun)) && optimize_bb_for_speed_p (bb) && branch_count + fallthru_count > count_threshold - && (branch_count - > fallthru_count.apply_scale - (param_align_loop_iterations, 1))) + && (branch_count > fallthru_count * param_align_loop_iterations)) { align_flags alignment = LOOP_ALIGN (label); if (dump_file) -- cgit v1.1