LDC cross-module-inlining

kinke kinke at gmx.net
Mon Aug 10 11:56:06 UTC 2020

On Monday, 10 August 2020 at 11:11:57 UTC, Per Nordlöw wrote:
> Are the official LDC-releases builtin with or without LTO?

Most of them are, but not sure why that matters here (the gain is 
almost negligible and mainly interesting for the C++ parts - as 
all D files are compiled to a single object file anyway).

> On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote:
>> I am not sure but last time I checked ldc does not do cross 
>> module inlinig by default,

Right, it's still experimental and has issues.

>> and LTO only help if your ldc(druntime+phobos) are built with 
>> enabled LTO

That's only true if (mostly non-templated) functions in 
druntime/Phobos are to be cross-module inlined, just like any 
other library. In that case, you can simply use 
`-flto=<thin|full> -defaultlib=phobos2-ldc-lto,druntime-ldc-lto` 
with LDC builds shipping with LTO druntime/Phobos and don't have 
to recompile druntime/Phobos manually anymore.

More information about the Digitalmars-d-learn mailing list