Commit 934677f9 by Richard Henderson Committed by Richard Henderson

bb-reorder.c (find_traces_1_round): Force fallthru edge from a call to be best_edge.

        * bb-reorder.c (find_traces_1_round): Force fallthru edge from a
        call to be best_edge.

From-SVN: r95062
parent e22857eb
2005-02-15 Richard Henderson <rth@redhat.com>
* bb-reorder.c (find_traces_1_round): Force fallthru edge from a
call to be best_edge.
2005-02-14 Kazu Hirata <kazu@cs.umass.edu> 2005-02-14 Kazu Hirata <kazu@cs.umass.edu>
* basic-block.h: Adjust the prototype for find_basic_blocks. * basic-block.h: Adjust the prototype for find_basic_blocks.
......
...@@ -488,6 +488,7 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th, ...@@ -488,6 +488,7 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
do do
{ {
int prob, freq; int prob, freq;
bool ends_in_call;
/* The probability and frequency of the best edge. */ /* The probability and frequency of the best edge. */
int best_prob = INT_MIN / 2; int best_prob = INT_MIN / 2;
...@@ -501,6 +502,8 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th, ...@@ -501,6 +502,8 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
fprintf (dump_file, "Basic block %d was visited in trace %d\n", fprintf (dump_file, "Basic block %d was visited in trace %d\n",
bb->index, *n_traces - 1); bb->index, *n_traces - 1);
ends_in_call = block_ends_with_call_p (bb);
/* Select the successor that will be placed after BB. */ /* Select the successor that will be placed after BB. */
FOR_EACH_EDGE (e, ei, bb->succs) FOR_EACH_EDGE (e, ei, bb->succs)
{ {
...@@ -520,6 +523,19 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th, ...@@ -520,6 +523,19 @@ find_traces_1_round (int branch_th, int exec_th, gcov_type count_th,
prob = e->probability; prob = e->probability;
freq = EDGE_FREQUENCY (e); freq = EDGE_FREQUENCY (e);
/* The only sensible preference for a call instruction is the
fallthru edge. Don't bother selecting anything else. */
if (ends_in_call)
{
if (e->flags & EDGE_CAN_FALLTHRU)
{
best_edge = e;
best_prob = prob;
best_freq = freq;
}
continue;
}
/* Edge that cannot be fallthru or improbable or infrequent /* Edge that cannot be fallthru or improbable or infrequent
successor (i.e. it is unsuitable successor). */ successor (i.e. it is unsuitable successor). */
if (!(e->flags & EDGE_CAN_FALLTHRU) || (e->flags & EDGE_COMPLEX) if (!(e->flags & EDGE_CAN_FALLTHRU) || (e->flags & EDGE_COMPLEX)
......
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