[llvm] r184881 - Print block frequencies in decimal form.

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jun 25 15:55:33 PDT 2013


On Jun 25, 2013, at 3:40 PM, Robinson, Paul <Paul_Robinson at playstation.sony.com> wrote:

>> Author: stoklund
>> Date: Tue Jun 25 16:57:38 2013
>> New Revision: 184881
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=184881&view=rev
>> Log:
>> Print block frequencies in decimal form.
>> 
>> This is easier to read than the internal fixed-point representation.
>> 
>> If anybody knows the correct algorithm for converting fixed-point
>> numbers to base 10, feel free to fix it.
> 
> The correct algorithm is to use a power-of-10 scale factor. :-)

That would work ;)

> I took a quick look through BlockFrequency.h/.cpp and didn't see
> any reason why ENTRY_FREQ could not be 1000 instead of 1024.
> The only arithmetic on pairs of frequencies is add/subtract so
> the scale factor is irrelevant to all the math operations.
> (I owned a COBOL compiler for a number of years; I know my way
> around decimal data.)

We also have multiplication, but only by int/int fractions. There are some computations in BlockFrequencyImpl.h that use EntryFreq, though.

If we can make all computations be BlockFrequency * BranchProb or BlockFrequency + BlockFrequency, then the scale really doesn’t matter.

Thanks,
/jakob





More information about the llvm-commits mailing list