Skip to content

Commit 71a31b3

Browse files
committed
Always use the ThinLTO pipeline for pre-link optimizations
When using cargo this was already effectively done for all dependencies as cargo passes -Clinker-plugin-lto without -Clto=fat/thin. -Clinker-plugin-lto assumes that ThinLTO will be used. The ThinLTO pre-link pipeline is faster than the fat LTO one. And according to the benchmarks in [1] there is barely any runtime performance difference between executables that used fat LTO with the fat vs ThinLTO pre-link pipeline. [1]: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774
1 parent f8704be commit 71a31b3

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,8 @@ extern "C" LLVMRustResult LLVMRustOptimize(
840840
}
841841
break;
842842
case LLVMRustOptStage::PreLinkThinLTO:
843-
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
844-
NeedThinLTOBufferPasses = false;
845-
break;
846843
case LLVMRustOptStage::PreLinkFatLTO:
847-
MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel);
844+
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
848845
NeedThinLTOBufferPasses = false;
849846
break;
850847
case LLVMRustOptStage::ThinLTO:

0 commit comments

Comments
 (0)