From 604617ba2a22e682ba2813a7782607c3b93ca7c2 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 26 Apr 2000 22:58:05 -0700 Subject: [PATCH] jump.c (invert_jump): Always invert REG_BR_PROB. * jump.c (invert_jump): Always invert REG_BR_PROB. Do it correctly. * bb-reorder.c (reorder_basic_blocks): Don't run estimate_probability. * flow.c (calculate_loop_depth): Remove. * output.h (calculate_loop_depth): Don't declare. * toplev.c (rest_of_compilation): Expand calculate_loop_depth inline; run estimate_probability at the same time. From-SVN: r33464 --- gcc/ChangeLog | 10 ++++++++++ gcc/bb-reorder.c | 4 ---- gcc/flow.c | 17 ----------------- gcc/jump.c | 18 +++++++----------- gcc/output.h | 1 - gcc/toplev.c | 17 ++++++++++++++++- 6 files changed, 33 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7931e3c..1d134c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2000-04-26 Richard Henderson + + * jump.c (invert_jump): Always invert REG_BR_PROB. Do it correctly. + + * bb-reorder.c (reorder_basic_blocks): Don't run estimate_probability. + * flow.c (calculate_loop_depth): Remove. + * output.h (calculate_loop_depth): Don't declare. + * toplev.c (rest_of_compilation): Expand calculate_loop_depth + inline; run estimate_probability at the same time. + 2000-04-26 Neil Booth * cpplib.h: "~=" is not a single pp-token. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 5f2e178..7812ff1 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -813,10 +813,6 @@ reorder_basic_blocks () /* Dump loop information. */ flow_loops_dump (&loops_info, rtl_dump_file, 0); - /* Estimate using heuristics if no profiling info is available. */ - if (! flag_branch_probabilities) - estimate_probability (&loops_info); - reorder_last_visited = BASIC_BLOCK (0); for (i = 0; i < n_basic_blocks; i++) diff --git a/gcc/flow.c b/gcc/flow.c index 7b249429..23402d3 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -2469,23 +2469,6 @@ tidy_fallthru_edges () tidy_fallthru_edge (s, b, c); } } - -/* Discover and record the loop depth at the head of each basic block. */ - -void -calculate_loop_depth (dump) - FILE *dump; -{ - struct loops loops; - - /* The loop infrastructure does the real job for us. */ - flow_loops_find (&loops); - - if (dump) - flow_loops_dump (&loops, dump, 0); - - flow_loops_free (&loops); -} /* Perform data flow analysis. F is the first insn of the function; FLAGS is a set of PROP_* flags diff --git a/gcc/jump.c b/gcc/jump.c index 6b5fecd..06b5bd5 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -4431,17 +4431,13 @@ invert_jump (jump, nlabel) if (redirect_jump (jump, nlabel)) { - if (flag_branch_probabilities) - { - rtx note = find_reg_note (jump, REG_BR_PROB, 0); - - /* An inverted jump means that a probability taken becomes a - probability not taken. Subtract the branch probability from the - probability base to convert it back to a taken probability. - (We don't flip the probability on a branch that's never taken. */ - if (note && XINT (XEXP (note, 0), 0) >= 0) - XINT (XEXP (note, 0), 0) = REG_BR_PROB_BASE - XINT (XEXP (note, 0), 0); - } + /* An inverted jump means that a probability taken becomes a + probability not taken. Subtract the branch probability from the + probability base to convert it back to a taken probability. */ + + rtx note = find_reg_note (jump, REG_BR_PROB, 0); + if (note) + XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0))); return 1; } diff --git a/gcc/output.h b/gcc/output.h index e54bc35..6af8de6 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -134,7 +134,6 @@ extern int regno_clobbered_at_setjmp PARAMS ((int)); extern void dump_flow_info PARAMS ((FILE *)); extern void find_basic_blocks PARAMS ((rtx, int, FILE *)); extern void cleanup_cfg PARAMS ((rtx)); -extern void calculate_loop_depth PARAMS ((FILE *)); extern void free_basic_block_vars PARAMS ((int)); extern void set_block_num PARAMS ((rtx, int)); #endif diff --git a/gcc/toplev.c b/gcc/toplev.c index dd8ea2a..65f7ee8 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3246,7 +3246,22 @@ rest_of_compilation (decl) find_basic_blocks (insns, max_reg_num (), rtl_dump_file); cleanup_cfg (insns); if (optimize) - calculate_loop_depth (rtl_dump_file); + { + struct loops loops; + + /* Discover and record the loop depth at the head of each basic + block. The loop infrastructure does the real job for us. */ + flow_loops_find (&loops); + + /* Estimate using heuristics if no profiling info is available. */ + if (! flag_branch_probabilities) + estimate_probability (&loops); + + if (rtl_dump_file) + flow_loops_dump (&loops, rtl_dump_file, 0); + + flow_loops_free (&loops); + } life_analysis (insns, rtl_dump_file, PROP_FINAL); mark_constant_function (); }); -- 2.7.4