Export (0) Print
Expand All
Expand Minimize

/LTCG (Link-time Code Generation)

/LTCG[:NOSTATUS|:STATUS]

where:

:NOSTATUS | :STATUS (optional)
Specifies whether the linker should display a progress indicator showing what percentage of the link is complete. The default is to not display this status information.

Remarks

The /LTCG option tells the linker to call the compiler and perform whole program optimization.

/LTCG is implied with /GL. If you use /GL with /c, you can use /LTCG when you link your .obj files for the fastest possible build performance.

/LTCG is not valid for use with /INCREMENTAL.

When /LTCG is used with either /Og, /O1, /O2, or /Ox, the following optimizations are performed:

  • Cross-module inlining
  • Interprocedural register allocation (64-bit operating systems only)
  • Custom calling convention (x86 only)
  • Small TLS displacement (x86 only)
  • Stack double alignment (x86 only)
  • Improved memory disambiguation (better interference information for global variables)

Using /LTCG and /Ogt will result in double-alignment optimization.

If /LTCG and /Ogs are specified, double alignment will not be performed. If most of the functions in an application are compiled for speed, with a few functions compiled for size (for example, by using the optimize pragma), the compiler will double align these functions that are optimized for size if they call functions that need double alignment.

To set this linker option in the Visual Studio development environment

/LTCG is specified when you also specify the /GL compiler option.

To set this linker option programmatically

See WholeProgramOptimization Property.

See Also

Setting Linker Options | Linker Options

Show:
© 2014 Microsoft