5.7.7.32 Lto-partition Option
The -flto-partition=algorithm
option
controls the algorithm used to partition object files when running the link-time optimizer.
Multiple partitions can be optimized in parallel, which might reduce the memory and processing
time required by the compiler.
The argument none
disables partitioning entirely and executes the link-time
optimization step directly from the whole program analysis (WPA) phase. This mode of operation
will produce the most optimal results at the expense of larger compiler memory requirements
and longer build times, although this is unlikely to be an issue with small programs.
The one
algorithm argument specifies that link-time optimizations should be
performed on the whole program as a single unit, rather than splitting it into smaller
partitions. This can result in better optimization opportunities, especially for
interprocedural analysis and transformations, but it also requires the most memory and
computational time during the link phase.
Selecting the option argument to 1to1
splits the program so that each
original compilation unit becomes a separate partition. This can reduce the computational
memory and time requirements significantly but might also reduce the runtime performance
benefits of the optimization.
The default argument is balanced
, which specifies partitioning into a given
number of parts of roughly the same size, based on the call graph. This algorithm tries to
balance the trade-off between computational memory and time, as well as runtime
performance.