[llvm-commits] [llvm] r136583 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp

Eli Friedman eli.friedman at gmail.com
Sat Jul 30 21:13:20 PDT 2011


On Sat, Jul 30, 2011 at 9:02 PM, Jakub Staszak <jstaszak at apple.com> wrote:
>
> -Kuba
> On Jul 30, 2011, at 8:53 PM, Eli Friedman wrote:
>
> On Sat, Jul 30, 2011 at 8:27 PM, Jakub Staszak <jstaszak at apple.com> wrote:
>
> Author: kuba
>
> Date: Sat Jul 30 22:27:24 2011
>
> New Revision: 136583
>
> URL: http://llvm.org/viewvc/llvm-project?rev=136583&view=rev
>
> Log:
>
> Add Zero Heurestics to BranchProbabilityInfo. If we compare value to zero we
>
> decide whether condition is likely to be true this way:
>
> x == 0  ->  false
>
> x <  0  ->  false
>
> x <= 0  ->  false
>
> x != 0  ->  true
>
> x >  0  ->  true
>
> x >= 0  ->  true
>
> What's the justification for these heuristics?
>
> It is one of the heuristics proposed in the paper "Static Branch Frequency
> and Program Profile Analysis". The other heuristics we have right now were
> also proposed there.

Okay.

> The LHS of a compare will never be zero after instcombine runs... so
> this check strikes me as unlikely to be useful.
>
> So instcombiner always moves zero (or constants in general) to RHS?

Yes.

-Eli




More information about the llvm-commits mailing list