[PATCH] Fix information loss in branch probability computation.

Diego Novillo dnovillo at google.com
Tue May 5 09:37:49 PDT 2015


On Fri, May 1, 2015 at 10:23 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:

> Hmm.  Now I see why you thought `ScaledNumber` should maybe have some
> short circults.
>
> I feel like `ScaledNumber` is too heavy-weight for this.  In BFI the
> global scale of the numbers is hard to predict, but here we're just
> dealing with a single basic block.  All the numbers are small.

They're below UINT32_MAX, sure. But for scaling purposes, we may
overflow 32-bits during the computation. At any rate, I agree that it
is actually easier to do the calculation in 64 bits and then cast
down.


Thanks. Diego.



More information about the llvm-commits mailing list