---
title: ThinLTO优化
description: "LTO优化技术分为FullLTO和ThinLTO两种，ThinLTO是一种更新的链接时优化技术，ThinLTO相比FullLTO具有更好的运行时性能表现，极大地缩短了链接时优化的耗时和内存占用。ThinLTO分为3个阶段："
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_30_0015.html
sourcePath: /source/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_30_0015.html
indexId: 0877974fb8d732ffe8020922a97bec7d7ee342d1e3d22af7c1f9f2c179d6f70d74
---
# ThinLTO优化

LTO优化技术分为FullLTO和ThinLTO两种，ThinLTO是一种更新的链接时优化技术，ThinLTO相比FullLTO具有更好的运行时性能表现，极大地缩短了链接时优化的耗时和内存占用。ThinLTO分为3个阶段：

1. Compile: 与FullLTO一样生成IR，但使用模块摘要进行了扩展。
2. Thin Link：用于组合模块摘要并执行全局分析的Thin Linker层。
3. ThinLTO后端：具有基于模块摘要的导入和优化的可并行执行的后端，使用全局索引来指导每个模块的优化和代码生成。

如下图所示（图片来自LLVM(https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html)）
