This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Change bb-reorder.c to use succ block frequency
- From: Pat Haugen <pthaugen at us dot ibm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: David Edelsohn <dje at watson dot ibm dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Jun 2005 09:29:29 -0500
- Subject: Re: [PATCH] Change bb-reorder.c to use succ block frequency
Richard Henderson <firstname.lastname@example.org> wrote on 06/13/2005 07:46:25 PM:
> On Mon, Jun 13, 2005 at 04:06:29PM -0400, David Edelsohn wrote:
> > >>>>> Richard Henderson writes:
> > Richard> Why? It seems to me that edge frequency is what's going to
> > Richard> to the cpu when considering the branch. Particularly forcpus
> > Richard> don't have horrendously sophisticated branch predictors.
> > From Pat's original message:
> > "Since edge frequency is based off the source block's frequency (src
> > freq * edge prob), this means the code in better_edge_p() which
> > frequencies if edge probabilities are equivalent is useless (if
> > probabilities are equivalent then the edge frequencies will also be
> > equivalent since they're based off the same block frequency)."
> > http://gcc.gnu.org/ml/gcc/2005-04/msg00638.html
> I don't see that that answers the question. The patch *completely
> the use of edge frequencies with block frequencies. It doesn't just use
> block frequencies to break ties in edge frequencies. I see no
> for this change except "the algorithm described in the comments". Why
> we not instead changing the comments to match the code?
> I've given you a plausible reason for why we might *want* to use edge
> frequencies. Please refute that in some way.
> When the edge frequencies are identical for conditional branches, I don't
> figure it matters one way or the other which successor we choose. I also
> expect this isn't the normal case or profiling would be useless.
better_edge_p() first compares edge probabilities to see which is the
better edge, if probabilities are equivalent then it proceeds to the
frequency test. It makes no sense to compare edge frequencies as a
tie-breaker when probabilities are equivalent because edge frequencies are
also going to be equivalent. The algorithm is trying to find the succ block
with the greatest affinity to the current block. The succ block with the
smallest frequency would be that block since the block with the larger
frequency is obtaining that larger frequency from a different predecessor
and therfore possibly has a better affinity to that predecessor.