[llvm-dev] Always running Regular LTO before ThinLTO?

Teresa Johnson via llvm-dev llvm-dev at lists.llvm.org
Mon May 24 15:34:17 PDT 2021


On Mon, May 24, 2021 at 3:14 PM Arthur Eubanks via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Looks like the secondary split LTO units (e.g. due to
> -fwhole-program-vtables) are being added together into one large module
> which is then monolithically LTO'd, which is where the extra passes were
> being run.
>

Right. Note you can run WPD in ThinLTO only mode by
passing -fno-split-lto-unit, which is a little less powerful in terms of
optimization (can't do virtual constant prop, although I'm not sure how
often this kicks in), and doesn't support CFI. Internally for our ThinLTO
builds when performing WPD for optimization (i.e. without CFI) we disable
the splitting for compile time scalability reasons.

Teresa


> splitAndWriteThinLTOBitcode():
>   // Mark the merged module as requiring full LTO. We still want an index
> for
>   // it though, so that it can participate in summary-based dead stripping.
>
>
> On Mon, May 24, 2021 at 12:32 PM Arthur Eubanks <aeubanks at google.com>
> wrote:
>
>> Ah I messed something up locally, removing the regular LTO run
>> causes undefined hidden symbol errors for vtables.
>> The `runRegularLTO()` name is confusing though, it apparently sets up
>> some things necessary for ThinLTO.
>>
>> On Mon, May 24, 2021 at 11:58 AM Arthur Eubanks <aeubanks at google.com>
>> wrote:
>>
>>> While debugging a ThinLTO issue, I noticed that passes were running more
>>> often than I expected. This is being invoked pretty normally, something like
>>> $ clang++ -fuse-ld=lld -flto=thin
>>>
>>> Looks like at [1] we try to first run regular LTO before
>>> running ThinLTO. Removing the first line makes the link go from 208s to
>>> 115s. Is this expected behavior?
>>>
>>> [1]:
>>> https://github.com/llvm/llvm-project/blob/a64ebb8637277998f77e55d335faca6fdcf5859b/llvm/lib/LTO/LTO.cpp#L1033
>>>
>> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>


-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210524/0f0256b5/attachment-0001.html>


More information about the llvm-dev mailing list