[llvm-dev] [RFC] Profile guided section layout

Tobias Edler von Koch via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 31 14:43:53 PDT 2017


Hi Rafael,

On 07/31/2017 04:20 PM, Rafael Avila de Espindola via llvm-dev wrote:
> However, do we need to start with instrumentation? The original paper
> uses sampling with good results and current intel cpus can record every
> branch in a program.
>
> I would propose starting with just an lld patch that reads the call
> graph from a file. The format would be very similar to what you propose,
> just weight,caller,callee.

The advantage of the proposed approach (weighted callgraph section) is 
that it's completely transparent: it works regardless of the particular 
profiling methodology (as long as there's !perf metadata when the pass 
runs). For this reason, it fits neatly into an *existing* PGO-based 
build flow. I only need to add 1 compiler flag to enable it. That's a 
big plus.

On the other hand, I could see how your idea (callgraph input file for 
linker) would be useful in situations where I just want to do section 
layout but no PGO in the compiler... and of course for testing of the 
linker's sorting algorithm.

So there's merits in both, but for my use cases Michael's original 
approach is the most practical.

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