@@ -419,16 +419,14 @@ static bool isLTOPostLink(ThinOrFullLTOPhase Phase) {
419419
420420// Helper to wrap conditionally Coro passes.
421421static CoroConditionalWrapper buildCoroWrapper (ThinOrFullLTOPhase Phase) {
422+ // TODO: Skip passes according to Phase.
422423 ModulePassManager CoroPM;
423- if (!isLTOPostLink (Phase))
424- CoroPM.addPass (CoroEarlyPass ());
425- if (!isLTOPreLink (Phase)) {
426- CGSCCPassManager CGPM;
427- CGPM.addPass (CoroSplitPass ());
428- CoroPM.addPass (createModuleToPostOrderCGSCCPassAdaptor (std::move (CGPM)));
429- CoroPM.addPass (CoroCleanupPass ());
430- CoroPM.addPass (GlobalDCEPass ());
431- }
424+ CoroPM.addPass (CoroEarlyPass ());
425+ CGSCCPassManager CGPM;
426+ CGPM.addPass (CoroSplitPass ());
427+ CoroPM.addPass (createModuleToPostOrderCGSCCPassAdaptor (std::move (CGPM)));
428+ CoroPM.addPass (CoroCleanupPass ());
429+ CoroPM.addPass (GlobalDCEPass ());
432430 return CoroConditionalWrapper (std::move (CoroPM));
433431}
434432
@@ -1012,7 +1010,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
10121010 MainCGPipeline.addPass (createCGSCCToFunctionPassAdaptor (
10131011 RequireAnalysisPass<ShouldNotRunFunctionPassesAnalysis, Function>()));
10141012
1015- if (! isLTOPreLink ( Phase) ) {
1013+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink ) {
10161014 MainCGPipeline.addPass (CoroSplitPass (Level != OptimizationLevel::O0));
10171015 MainCGPipeline.addPass (CoroAnnotationElidePass ());
10181016 }
@@ -1062,7 +1060,7 @@ PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level,
10621060 buildFunctionSimplificationPipeline (Level, Phase),
10631061 PTO.EagerlyInvalidateAnalyses ));
10641062
1065- if (! isLTOPreLink ( Phase) ) {
1063+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink ) {
10661064 MPM.addPass (createModuleToPostOrderCGSCCPassAdaptor (
10671065 CoroSplitPass (Level != OptimizationLevel::O0)));
10681066 MPM.addPass (
@@ -1122,8 +1120,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
11221120 // Do basic inference of function attributes from known properties of system
11231121 // libraries and other oracles.
11241122 MPM.addPass (InferFunctionAttrsPass ());
1125- if (!isLTOPostLink (Phase))
1126- MPM.addPass (CoroEarlyPass ());
1123+ MPM.addPass (CoroEarlyPass ());
11271124
11281125 FunctionPassManager EarlyFPM;
11291126 EarlyFPM.addPass (EntryExitInstrumenterPass (/* PostInlining=*/ false ));
@@ -1293,7 +1290,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
12931290 // and argument promotion.
12941291 MPM.addPass (DeadArgumentEliminationPass ());
12951292
1296- if (! isLTOPreLink ( Phase) )
1293+ if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink )
12971294 MPM.addPass (CoroCleanupPass ());
12981295
12991296 // Optimize globals now that functions are fully simplified.
@@ -1958,6 +1955,9 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
19581955 return MPM;
19591956 }
19601957
1958+ // TODO: Skip to match buildCoroWrapper.
1959+ MPM.addPass (CoroEarlyPass ());
1960+
19611961 // Optimize globals to try and fold them into constants.
19621962 MPM.addPass (GlobalOptPass ());
19631963
0 commit comments