GCC、MSVC、LLVM 和可能的其他工具链支持链接时(整个程序)优化,以允许优化编译单元之间的调用.
GCC, MSVC, LLVM, and probably other toolchains have support for link-time (whole program) optimization to allow optimization of calls among compilation units.
编译生产软件时是否有理由不启用此选项?
Is there a reason not to enable this option when compiling production software?
我假设 生产软件"是指您交付给客户/投入生产的软件.为什么不总是使用编译器优化?(由 Mankarse) 主要适用于您想要调试代码(因此该软件仍处于开发阶段 - 未投入生产).
I assume that by "production software" you mean software that you ship to the customers / goes into production. The answers at Why not always use compiler optimization? (kindly pointed out by Mankarse) mostly apply to situations in which you want to debug your code (so the software is still in the development phase -- not in production).
自从我写下这个答案已经过去了 6 年,需要更新.早在 2014 年,问题是:
6 years have passed since I wrote this answer, and an update is necessary. Back in 2014, the issues were:
从 2020 年开始,我将尝试在我的任何项目中默认使用 LTO.
As of 2020, I would try to use LTO by default on any of my projects.
这篇关于是否有理由不使用链接时优化 (LTO)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!