cfgcleanup.c (outgoing_edges_math): Fix condition; relax frequencies match; avoid match on different loop depths.

* cfgcleanup.c (outgoing_edges_math): Fix condition; relax
	frequencies match; avoid match on different loop depths.
	(try_crossjump_to_bb): Kill tests that no longer brings time
	savings.
	* cfgrtl.c (force_nonfallthru_and_redirect): Fix loop_depth
	updating code.
	(split_edge): Likewise.

From-SVN: r51174
This commit is contained in:
Jan Hubicka 2002-03-22 16:17:35 +01:00 committed by Jan Hubicka
parent 6eac0433c9
commit df8638793a
3 changed files with 31 additions and 7 deletions

View File

@ -1,3 +1,13 @@
Fri Mar 22 16:00:06 CET 2002 Jan Hubicka <jh@suse.cz>
* cfgcleanup.c (outgoing_edges_math): Fix condition; relax
frequencies match; avoid match on different loop depths.
(try_crossjump_to_bb): Kill tests that no longer brings time
savings.
* cfgrtl.c (force_nonfallthru_and_redirect): Fix loop_depth
updating code.
(split_edge): Likewise.
2002-03-21 Richard Henderson <rth@redhat.com>
PR target/5996

View File

@ -1097,9 +1097,20 @@ outgoing_edges_match (mode, bb1, bb2)
if (!bb2->succ
|| !bb2->succ->succ_next
|| bb1->succ->succ_next->succ_next
|| bb2->succ->succ_next->succ_next
|| !any_condjump_p (bb2->end)
|| !onlyjump_p (bb1->end))
|| !onlyjump_p (bb2->end))
return false;
/* Do not crossjump across loop boundaries. This is a temporary
workaround for the common scenario in which crossjumping results
in killing the duplicated loop condition, making bb-reorder rotate
the loop incorectly, leaving an extra unconditional jump inside
the loop.
This check should go away once bb-reorder knows how to duplicate
code in this case or rotate the loops to avoid this scenario. */
if (bb1->loop_depth != bb2->loop_depth)
return false;
b1 = BRANCH_EDGE (bb1);
@ -1175,9 +1186,10 @@ outgoing_edges_match (mode, bb1, bb2)
/* Do not use f2 probability as f2 may be forwarded. */
prob2 = REG_BR_PROB_BASE - b2->probability;
/* Fail if the difference in probabilities is
greater than 5%. */
if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 20)
/* Fail if the difference in probabilities is greater than 50%.
This rules out two well-predicted branches with opposite
outcomes. */
if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 2)
{
if (rtl_dump_file)
fprintf (rtl_dump_file,
@ -1278,12 +1290,10 @@ try_crossjump_to_edge (mode, e1, e2)
away. We do this to look past the unconditional jump following a
conditional jump that is required due to the current CFG shape. */
if (src1->pred
&& !src1->pred->pred_next
&& FORWARDER_BLOCK_P (src1))
e1 = src1->pred, src1 = e1->src;
if (src2->pred
&& !src2->pred->pred_next
&& FORWARDER_BLOCK_P (src2))
e2 = src2->pred, src2 = e2->src;

View File

@ -928,6 +928,9 @@ force_nonfallthru_and_redirect (e, target)
/* Change the existing edge's source to be the new block, and add
a new edge from the entry block to the new block. */
e->src = bb;
bb->count = e->count;
bb->frequency = EDGE_FREQUENCY (e);
bb->loop_depth = 0;
for (pe1 = &ENTRY_BLOCK_PTR->succ; *pe1; pe1 = &(*pe1)->succ_next)
if (*pe1 == e)
{
@ -1214,6 +1217,7 @@ split_edge (edge_in)
: edge_in->dest->index, before, NULL);
bb->count = edge_in->count;
bb->frequency = EDGE_FREQUENCY (edge_in);
bb->loop_depth = edge_in->dest->loop_depth;
/* ??? This info is likely going to be out of date very soon. */
if (edge_in->dest->global_live_at_start)