[LLVMdev] Capabilities of Clang's PGO (e.g. improving code density)

Diego Novillo dnovillo at google.com
Thu May 28 12:26:57 PDT 2015



On 05/28/15 14:08, Teresa Johnson wrote:
> On Thu, May 28, 2015 at 9:56 AM, Philip Reames
> <listmail at philipreames.com> wrote:
>> OT: Can you give me a pointer to the clang code involved?  I wasn't aware of
>> this.
> It is set in clang/lib/CodeGen/CodeGenPGO.cpp
> CodeGenPGO::applyFunctionAttributes.
>
> Note that it uses the function entry count to determine hotness. This
> means that functions entered infrequently but containing very hot
> loops would be marked cold, perhaps this works since it is only used
> for inlining and is presumably a stand-in for call edge hotness. The
> MaxFunctionCount for the profile is also the max of all the function
> entry counts (set during profile writing).

Right. We now also have function entry counts propagated into the IR. 
This gives the inliner a way to compute global hotness using entry 
counts and internal frequencies.

Diego.



More information about the llvm-dev mailing list