[PATCH] D36351: [lld][ELF] Add profile guided section layout

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 20:04:33 PST 2018


Michael Spencer <bigcheesegs at gmail.com> writes:

> On Thu, Feb 8, 2018 at 4:04 PM, Rafael Avila de Espindola <
> rafael.espindola at gmail.com> wrote:
>
>> Looking a bit more on why I might not be measuring a performance
>> improvement I noticed that the callgraph I was using was missing
>> conditional calls. The attached script fixes that.
>>
>> I have uploaded a new version of the test with the complete call graph
>> to https://s3-us-west-2.amazonaws.com/linker-tests/t2.tar.xz.
>>
>> I also noticed that we were not considering the case of multiple symbols
>> in the same section. The attached patch fixes that.
>>
>
> This is already handled in `CallGraphSort::CallGraphSort()` here:
>
>     NodeIndex From = GetOrCreateNode(FromSB);
>     NodeIndex To = GetOrCreateNode(ToSB);
>
>     Nodes[To].Weight = SaturatingAdd(Nodes[To].Weight, Weight);
>
>     if (From == To)
>       continue;
>
> It's specifically done here after the node weight adjustment so that
> density calculation later on takes this into account.

The

      +    if (FromSec && ToSec) {
      +      uint64_t &V = Config->CallGraphProfile[std::make_pair(FromSec, ToSec)];
      +      V += Count;
      +    }

part is still necessary

I have built hfsort for comparison. It does a better job, so there is
something else missing from this implementation.

I have updated the test at
https://s3-us-west-2.amazonaws.com/linker-tests/t2.tar.xz.

It now includes hfsort (since it is hard to build) and tests both this
patch and the 3 algorithms hfsort implements.

The results I got are attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mylog
Type: application/octet-stream
Size: 5148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/8acfa3fd/attachment.obj>
-------------- next part --------------

Cheers,
Rafael


More information about the llvm-commits mailing list