Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Analysis

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

llvm_compiler_dev
LLVM & Clang Hacker
MEMBER
担当者: 139
参加日: Jul 2018
投稿: 21
ありがとう: 15
1 か月前 · 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
担当者: 146
参加日: Aug 2019
投稿: 33
ありがとう: 31
1 か月前 · 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
担当者: 103
参加日: Apr 2018
投稿: 40
ありがとう: 24
1 か月前 · Jul 5, 2026 4:43 AM
#3

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