GCC Patches Posted For Implementing Incremental LTO

Written by Michael Larabel in GNU on 18 November 2023 at 06:53 AM EST. 3 Comments
GNU
Michal Jires of SUSE posted a new set of patches on Friday for implementing Incremental LTO support for the GNU Compiler Collection. The goal here with Incremental LTO is for reducing compile times while doing quick edit-compile cycles while employing Link-Time Optimizations.

Jires summed up the patch series as:
These patches implement Incremental LTO, specifically by caching results of ltrans phase. Secondarily these patches contain changes to reduce divergence of ltrans partitions so that they can be cached.

The aim is to reduce compile times for quick edit-compile cycles while using LTO. Even with these minimal changes to the rest of GCC it works surprisingly well. Currently testing by self compiling cc1, with individual commits used as incremental changes, on average only ~1/3 of partitions need to be recompiled with `-O2 -g0` and ~1/2 with `-O2 -g`. Which directly reduces time spent in ltrans phase of LTO.

Unfortunately larger gains are a bit fragile. You may remember that during my Cauldron talk I claimed reduction to ~1/6 and ~1/3 recompilations. That was achieved with branch from March. Since then there were at least two commits which introduced new divergence of partitions, though they seem fixable in future.

Given the timing though this Incremental LTO support seems unlikely to be merged for the upcoming GCC 14 release. In any event this Incremental LTO support should be interesting for those frequently compiling their code while wishing to employ LTO and keep build times to a minimum. His GNU Tools Cauldron 2023 slides haven't been uploaded yet for those interested in that background material.

This is certainly a great feature and akin to the work going on in the LLVM camp with ThinLTO for having link-time optimizations that are scalable and incremental. Hopefully GCC's Incremental LTO support will be worked into good enough shape for upstreaming in the near future.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week