[PATCH] InstrProf: Calculate a better function hash

Chandler Carruth chandlerc at google.com
Thu Apr 10 03:45:44 PDT 2014


Sorry for delays, took vacation around EuroLLVM... I'll try to catch up on
some of these, but will probably only hit full steam again next week.

On Wed, Mar 26, 2014 at 11:27 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> The hash here (Working) is just like any other number in IRGen.  Its byte-
> swapping requirements are no different from, e.g.,
> CodeGenPGO::NumRegionCounters.
>
> Here’s the flow (with the current file formats):
>
>   - IRGen emits an i64 as part of the __llvm_profile_data_foo aggregate.
>
>   - CodeGen emits it in the right section, byte swapping if host!=target.
>
>   - The profile runtime dumps it in the raw binary format.  This code is in
>     compiler-rt:lib/profile/InstrProfilingFile.c and
>     compiler-rt:lib/profile/InstrProfilingBuffer.c.
>
>   - llvm-profdata reads it in, byte swapping if host!=target.  This code is
>     in llvm:lib/ProfileData/InstrProfReader.cpp.
>

Ahh, ok. The part I was missing here was that the raw format is
target-endian rather than endian neutral. That makes a lot of sense (for
the same reason I originally pushed for having the raw format be different
from the merged final format), but it just didn't click initially that this
is why everything works.

I'll take another look at the patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140410/265d4fe1/attachment.html>


More information about the cfe-commits mailing list