We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be01f42 commit 074bbc6Copy full SHA for 074bbc6
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -1004,7 +1004,10 @@ LLVMRustOptimizeWithNewPassManager(
1004
#endif
1005
bool NeedThinLTOBufferPasses = UseThinLTOBuffers;
1006
if (!NoPrepopulatePasses) {
1007
- if (OptLevel == OptimizationLevel::O0) {
+ // The pre-link pipelines don't support O0 and require using budilO0DefaultPipeline() instead.
1008
+ // At the same time, the LTO pipelines do support O0 and using them is required.
1009
+ bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO || OptStage == LLVMRustOptStage::FatLTO;
1010
+ if (OptLevel == OptimizationLevel::O0 && !IsLTO) {
1011
#if LLVM_VERSION_GE(12, 0)
1012
for (const auto &C : PipelineStartEPCallbacks)
1013
PB.registerPipelineStartEPCallback(C);
0 commit comments