File tree Expand file tree Collapse file tree
compiler/rustc_llvm/llvm-wrapper Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -815,24 +815,19 @@ extern "C" LLVMRustResult LLVMRustOptimize(
815815 bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO ||
816816 OptStage == LLVMRustOptStage::FatLTO;
817817 if (!NoPrepopulatePasses) {
818+ for (const auto &C : PipelineStartEPCallbacks)
819+ PB.registerPipelineStartEPCallback (C);
820+ for (const auto &C : OptimizerLastEPCallbacks)
821+ PB.registerOptimizerLastEPCallback (C);
822+
818823 // The pre-link pipelines don't support O0 and require using
819824 // buildO0DefaultPipeline() instead. At the same time, the LTO pipelines do
820825 // support O0 and using them is required.
821826 if (OptLevel == OptimizationLevel::O0 && !IsLTO) {
822- for (const auto &C : PipelineStartEPCallbacks)
823- PB.registerPipelineStartEPCallback (C);
824- for (const auto &C : OptimizerLastEPCallbacks)
825- PB.registerOptimizerLastEPCallback (C);
826-
827827 // We manually schedule ThinLTOBufferPasses below, so don't pass the value
828828 // to enable it here.
829829 MPM = PB.buildO0DefaultPipeline (OptLevel);
830830 } else {
831- for (const auto &C : PipelineStartEPCallbacks)
832- PB.registerPipelineStartEPCallback (C);
833- for (const auto &C : OptimizerLastEPCallbacks)
834- PB.registerOptimizerLastEPCallback (C);
835-
836831 switch (OptStage) {
837832 case LLVMRustOptStage::PreLinkNoLTO:
838833 if (ThinLTOBufferRef) {
You can’t perform that action at this time.
0 commit comments