Link time optimization in D

Vladimir Panteleev vladimir at thecybershadow.net
Tue Jun 1 03:01:40 PDT 2010


On Tue, 01 Jun 2010 10:56:47 +0300, Alex Makhotin <alex at bitprox.com> wrote:

> So the best way to build release version(assuming two-phase build)  
> should be:
>
> 1. Synchronize DMD compilation switches with DMD link switches(-release  
> -O -inline).
> 2. Pass all the project sources in one DMD cmd line, compile.
> 3. Link produced object file with other libs.
>
> Am I correct?

"-release -O -inline" are all compiler switches, and do not apply to the  
linker.

Speaking of link-time optimization:

I assume that the standard library is not subjected to link-time  
optimization, because all code is used from the .lib.

Doesn't this mean that standard library functions will never be inlined?  
Even very short functions, that merely return a value? (e.g. range.length)

I suppose that the same applies to the runtime, but if the runtime  
functions were short enough to be inlined, the compiler could just  
generate the appropriate machine code instead.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list