mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Schedule ThinLTOBuffer passes again after sanitizer passes
This works around a design defect in the LLVM 12 pass builder implementation. In LLVM 13, the PreLink ThinLTO pipeline properly respects the OptimizerLastEPCallbacks.
This commit is contained in:
parent
ea0aa8def3
commit
9a8acea783
@ -1015,7 +1015,12 @@ LLVMRustOptimizeWithNewPassManager(
|
|||||||
case LLVMRustOptStage::PreLinkThinLTO:
|
case LLVMRustOptStage::PreLinkThinLTO:
|
||||||
#if LLVM_VERSION_GE(12, 0)
|
#if LLVM_VERSION_GE(12, 0)
|
||||||
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
|
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
|
||||||
NeedThinLTOBufferPasses = false;
|
// The ThinLTOPreLink pipeline already includes ThinLTOBuffer passes. However, callback
|
||||||
|
// passes may still run afterwards. This means we need to run the buffer passes again.
|
||||||
|
// FIXME: In LLVM 13, the ThinLTOPreLink pipeline also runs OptimizerLastEPCallbacks
|
||||||
|
// before the RequiredLTOPreLinkPasses, in which case we can remove these hacks.
|
||||||
|
if (OptimizerLastEPCallbacks.empty())
|
||||||
|
NeedThinLTOBufferPasses = false;
|
||||||
#else
|
#else
|
||||||
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
|
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user