Developer knowledge network · moderated exchange

UnreliableCode 커뮤니티

개발자 연구, 리버스 엔지니어링 및 코딩 커뮤니티

Knowledge index살다
4Categories
919Threads
2.8K게시물
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.