[llvm-dev] [RFC] Profile guided section layout
Tobias Edler von Koch via llvm-dev
llvm-dev at lists.llvm.org
Thu Jun 15 10:08:00 PDT 2017
Hi Michael,
This is cool stuff, thanks for sharing!
On 06/15/2017 11:51 AM, Michael Spencer via llvm-dev wrote:
> The first is a new llvm pass which uses branch frequency info to get
> counts for each call instruction and then adds a module flags
> metatdata table of function -> function edges along with their counts.
>
> The second takes the module flags metadata and writes it into a
> .note.llvm.callgraph section in the object file. This currently just
> dumps it as text, but could save space by reusing the string table.
Have you considered reading the profile in the linker and extracting
that information directly from the profile? The profile should contain
call sites and their sample counts and you could match these up with
relocations (calls) in the section?
> It doesn't currently work for LTO as the llvm pass needs to be run
> after all inlining decisions have been made and LTO codegen has to be
> done with -ffunction-sections.
So this is just an implementation issue, right? You can make LTO run
with -ffunction-sections (by setting
TargetOptions.FunctionSections=true) and insert your pass in the
appropriate place in the pipeline.
Thanks,
Tobias
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
More information about the llvm-dev
mailing list