Use correct pipeline for LTO at O0
Unlike the pre-link piplines, the LTO pipelines do support O0, and using them is required to avoid leaving behind undefined references for the linker.
This commit is contained in:
parent
be01f42f73
commit
074bbc6b87
1 changed files with 4 additions and 1 deletions
|
@ -1004,7 +1004,10 @@ LLVMRustOptimizeWithNewPassManager(
|
||||||
#endif
|
#endif
|
||||||
bool NeedThinLTOBufferPasses = UseThinLTOBuffers;
|
bool NeedThinLTOBufferPasses = UseThinLTOBuffers;
|
||||||
if (!NoPrepopulatePasses) {
|
if (!NoPrepopulatePasses) {
|
||||||
if (OptLevel == OptimizationLevel::O0) {
|
// The pre-link pipelines don't support O0 and require using budilO0DefaultPipeline() instead.
|
||||||
|
// At the same time, the LTO pipelines do support O0 and using them is required.
|
||||||
|
bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO || OptStage == LLVMRustOptStage::FatLTO;
|
||||||
|
if (OptLevel == OptimizationLevel::O0 && !IsLTO) {
|
||||||
#if LLVM_VERSION_GE(12, 0)
|
#if LLVM_VERSION_GE(12, 0)
|
||||||
for (const auto &C : PipelineStartEPCallbacks)
|
for (const auto &C : PipelineStartEPCallbacks)
|
||||||
PB.registerPipelineStartEPCallback(C);
|
PB.registerPipelineStartEPCallback(C);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue