Link Time Optimization

From CDOT Wiki
Jump to: navigation, search

Link Time Optimization (LTO) defers some portions of a program's optimization from compile time to link time. In order to accomplish this, the internal representation (IR) of each portion of the program (compilation unit) must be stored in the object file. On a Linux system, this is performed with additional ELF sections.

Without LTO, there is little or no information stored about code in separate compilation units such as code size (relevant to loop unrolling) and potential return values (relevant to dead code removal), preventing the application of certain optimizations when code is compiled in separate units and then combined in a link step. With LTO, the presence of IR data permits a number of optimizations to be applied at link time.