Commit 604617ba by Richard Henderson Committed by Richard Henderson

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
parent 6777db6d
2000-04-26 Richard Henderson <rth@cygnus.com>
* 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 <NeilB@earthling.net> 2000-04-26 Neil Booth <NeilB@earthling.net>
* cpplib.h: "~=" is not a single pp-token. * cpplib.h: "~=" is not a single pp-token.
......
...@@ -813,10 +813,6 @@ reorder_basic_blocks () ...@@ -813,10 +813,6 @@ reorder_basic_blocks ()
/* Dump loop information. */ /* Dump loop information. */
flow_loops_dump (&loops_info, rtl_dump_file, 0); 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); reorder_last_visited = BASIC_BLOCK (0);
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
......
...@@ -2469,23 +2469,6 @@ tidy_fallthru_edges () ...@@ -2469,23 +2469,6 @@ tidy_fallthru_edges ()
tidy_fallthru_edge (s, b, c); 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. /* Perform data flow analysis.
F is the first insn of the function; FLAGS is a set of PROP_* flags F is the first insn of the function; FLAGS is a set of PROP_* flags
......
...@@ -4431,17 +4431,13 @@ invert_jump (jump, nlabel) ...@@ -4431,17 +4431,13 @@ invert_jump (jump, nlabel)
if (redirect_jump (jump, nlabel)) if (redirect_jump (jump, nlabel))
{ {
if (flag_branch_probabilities) /* An inverted jump means that a probability taken becomes a
{ probability not taken. Subtract the branch probability from the
rtx note = find_reg_note (jump, REG_BR_PROB, 0); probability base to convert it back to a taken probability. */
/* An inverted jump means that a probability taken becomes a rtx note = find_reg_note (jump, REG_BR_PROB, 0);
probability not taken. Subtract the branch probability from the if (note)
probability base to convert it back to a taken probability. XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0)));
(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);
}
return 1; return 1;
} }
......
...@@ -134,7 +134,6 @@ extern int regno_clobbered_at_setjmp PARAMS ((int)); ...@@ -134,7 +134,6 @@ extern int regno_clobbered_at_setjmp PARAMS ((int));
extern void dump_flow_info PARAMS ((FILE *)); extern void dump_flow_info PARAMS ((FILE *));
extern void find_basic_blocks PARAMS ((rtx, int, FILE *)); extern void find_basic_blocks PARAMS ((rtx, int, FILE *));
extern void cleanup_cfg PARAMS ((rtx)); extern void cleanup_cfg PARAMS ((rtx));
extern void calculate_loop_depth PARAMS ((FILE *));
extern void free_basic_block_vars PARAMS ((int)); extern void free_basic_block_vars PARAMS ((int));
extern void set_block_num PARAMS ((rtx, int)); extern void set_block_num PARAMS ((rtx, int));
#endif #endif
......
...@@ -3246,7 +3246,22 @@ rest_of_compilation (decl) ...@@ -3246,7 +3246,22 @@ rest_of_compilation (decl)
find_basic_blocks (insns, max_reg_num (), rtl_dump_file); find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (insns); cleanup_cfg (insns);
if (optimize) 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); life_analysis (insns, rtl_dump_file, PROP_FINAL);
mark_constant_function (); mark_constant_function ();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment