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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 21:54:09 PST 2017


Thanks! I'll try this again.

I was thinking what was wrong with my last attempt today, and my hypothesis
is that the last run of `bin/llvm-profdata` immediately opens
`default.profraw` file for writing (i.e. truncating the file) because
`bin/llvm-profdata` is also compiled with profiling enabled. That explains
why I got an empty file.

On Mon, Dec 4, 2017 at 2:30 PM, Michael Spencer <bigcheesegs at gmail.com>
wrote:

> I've attached updated patches.
>
> I just tested these patches on Linux based on {llvm, clang, compiler-rt,
> lld} as of r319686 and everything worked just fine with the following steps:
>
> * Applied the patches.
> * Built llvm, clang, compiler-rt and lld in a Release build.
> (cgprofile-build)
> * Built llvm, and lld in a Release build using the clang from
> cgprofile-build with `-fprofile-instr-generate`. (instrumented-build)
> * Ran `check-lld` on instrumented-build
> * Ran `cgprofile-build/llvm-profdata merge <PATH-TO-LLVM-SOURCE>/llvm-
> project/lld/test/ELF/default.profraw -o default.profdata` in the
> instrumented-build directory
> * Built llvm, and lld in a Release build using the clang from
> cgprofile-build with `-fprofile-instr-use=default.profdata`.
> (cg-profile-optimized-build)
> * Checked that the .o files from cg-profile-optimized-build had call graph
> profiles using `cgprofile-build/llvm-readobj -elf-cg-profile`
>
> - Michael Spencer
>
> On Mon, Nov 27, 2017 at 9:11 PM, Michael Spencer <bigcheesegs at gmail.com>
> wrote:
>
>> On Mon, Nov 27, 2017 at 9:07 PM, Davide Italiano <davide at freebsd.org>
>> wrote:
>>
>>> Maybe this happens only on Linux? As far as I can tell the patch has
>>> been developed on Windows entirely. Michael, have you tried linux?
>>>
>>
>> It has been tested mostly on Linux.
>>
>> - Michael Spencer
>>
>>
>>>
>>> On Nov 27, 2017 9:05 PM, "Michael Spencer" <bigcheesegs at gmail.com>
>>> wrote:
>>>
>>>> On Mon, Nov 27, 2017 at 5:44 PM, Rui Ueyama <ruiu at google.com> wrote:
>>>>
>>>>> I rebased the patches to HEAD and tried to use it again. When I ran
>>>>> `bin/llvm-profdata merge default.profraw -o default.profdata`, it creates
>>>>> almost empty default.profdata and it shrunk default.profraw. That seems
>>>>> pretty odd to me. Michael, do you know what is going on?
>>>>>
>>>>> Before:
>>>>>
>>>>> -rw-r-----  1 ruiu eng  29M Nov 27 17:39 default.profraw
>>>>>
>>>>> After:
>>>>>
>>>>> -rw-r-----  1 ruiu eng  560 Nov 27 17:39 default.profdata
>>>>> -rw-r-----  1 ruiu eng 2.2M Nov 27 17:39 default.profraw
>>>>>
>>>>> The rebased patch is available at https://reviews.llvm.org/D40534.
>>>>>
>>>>
>>>> I'm not sure what the issue is without more information. My patch
>>>> doesn't change how llvm profile information works, it only uses the data.
>>>>
>>>> - Michael Spencer
>>>>
>>>>
>>>>>
>>>>> On Mon, Nov 27, 2017 at 2:01 PM, Davide Italiano <davide at freebsd.org>
>>>>> wrote:
>>>>>
>>>>>> On Mon, Nov 27, 2017 at 1:49 PM, Rui Ueyama <ruiu at google.com> wrote:
>>>>>> > I'm so sorry that I didn't respond in a timely manner. I'm reading
>>>>>> it again
>>>>>> > now.
>>>>>> >
>>>>>>
>>>>>> No worries, definitely not your fault. The whole back and forth has
>>>>>> been a little slow, but this has been around for almost 6 months now
>>>>>> (and has been in development for much longer) so we should really
>>>>>> decide whether we want to ship it or kill it :)
>>>>>>
>>>>>
>>>>>
>>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171204/1fd00b72/attachment.html>


More information about the llvm-commits mailing list