This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: disabling branch probability guessing (patch) [another patch]

I've been fighting a lonely battle for "predicting" (or favoring) the
branch which leads to iteration.  Some of the current compilers do a
lousy job of

for( ; ; ){

as the scheme of always assuming forward jumps not taken implies in this
common situation that the loop never repeats.  Until I saw the current
crop of compilers, I thought that favoring the branch which leads to
continued iteration was a usual practice.  Yes, there's are work-around,
always place a break in an else branch, but I never before saw code
written in this style:

else {

----- Original Message -----
From: "Richard Henderson" <>
To: "Aldy Hernandez" <>
Cc: "Andi Kleen" <>; "Joe Buck" <>;
Sent: Monday, January 22, 2001 2:17 PM
Subject: Re: disabling branch probability guessing (patch) [another

> On Sat, Jan 20, 2001 at 03:03:30AM -0400, Aldy Hernandez wrote:
> >  > I agree that that would be a good heuristic. Assume goto as not
> >
> > Alright.  I did some playing around to predict gotos as not taken
> > (patch below).  It seems to work pretty good.
> I don't necessarily agree that this is a good heuristic.  It assumes
> a rather rigid adherence to one programming style.  One that doesn't
> apply at all to machine generated code I might add.
> Placed as this check is, we get no chance to make potentially better
> guesses based on the shape of the CFG or other tell-tales.  I wouldn't
> mind this test as one of several being combined, but on its own I'm
> dubious.
> r~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]