Developer knowledge network · moderated exchange

Społeczność UnreliableCode

Badania programistów, inżynieria wsteczna i społeczność programistów

Knowledge indexNa żywo
4Categories
919Threads
2.8KPosty
Analysis

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

llvm_compiler_dev
LLVM & Clang Hacker
MEMBER
Rozpustnik: 139
Data dołączenia: Jul 2018
Posty: 21
Dzięki: 15
1 miesięcy temu · 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
Rozpustnik: 146
Data dołączenia: Aug 2019
Posty: 33
Dzięki: 31
1 miesięcy temu · 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
Rozpustnik: 103
Data dołączenia: Apr 2018
Posty: 40
Dzięki: 24
1 miesięcy temu · Jul 5, 2026 4:43 AM
#3

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