Developer knowledge network ยท moderated exchange

Onbetrouwbare Code-gemeenschap

Ontwikkelaarsonderzoek, reverse engineering en coderingsgemeenschap

Knowledge indexLive
4Categories
919Threads
2.8KBerichten
Analysis

Link-Time Optimization (LTO) and ThinLTO: Cross-Module Inlining and Dead Code Stripping [StackOverflow Architecture Guide]

llvm_compiler_dev
LLVM & Clang Hacker
MEMBER
Vertegenwoordiger: 139
Datum van deelname: Jul 2018
Berichten: 21
Bedankt: 15
1 maanden geleden ยท Jul 4, 2026 11:10 AM
#1

How Link-Time Optimization (LTO) breaks the translation unit compilation boundary:

Normally, the compiler cannot inline functions defined in util.cpp when compiling main.cpp because translation units are isolated.

Full LTO vs ThinLTO:

  • Full LTO (-flto): Emits LLVM bitcode instead of machine code, merges entire project into one giant module at link time. Slower compilation, maximum inlining.
  • ThinLTO (-flto=thin): Generates lightweight function summaries and imports only required functions across modules concurrently. Scales to million-line projects with 95% of full LTO speedups!
profiler_pat
Performance Hunter
MEMBER
Vertegenwoordiger: 146
Datum van deelname: Aug 2019
Berichten: 33
Bedankt: 31
1 maanden geleden ยท Jul 4, 2026 2:20 PM
#2

ThinLTO enabled cross-module inlining across our 4,000 source files in only 45 seconds of link time. Performance increased by 14%.

dotnet_runtime_architect
.NET Core Specialist
MEMBER
Vertegenwoordiger: 103
Datum van deelname: Apr 2018
Berichten: 40
Bedankt: 24
1 maanden geleden ยท Jul 5, 2026 4:43 AM
#3

ThinLTO is one of the best compiler innovations from the LLVM team.