[Coroutines] Run coroutine passes by default · llvm/llvm-project@8a1727b (original) (raw)
`@@ -283,7 +283,6 @@ PipelineTuningOptions::PipelineTuningOptions() {
`
283
283
` SLPVectorization = false;
`
284
284
` LoopUnrolling = true;
`
285
285
` ForgetAllSCEVInLoopUnroll = ForgetSCEVInLoopUnroll;
`
286
``
`-
Coroutines = false;
`
287
286
` LicmMssaOptCap = SetLicmMssaOptCap;
`
288
287
` LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
`
289
288
` CallGraphProfile = true;
`
`@@ -649,8 +648,7 @@ PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
`
649
648
` FPM.addPass(InstCombinePass());
`
650
649
`invokePeepholeEPCallbacks(FPM, Level);
`
651
650
``
652
``
`-
if (PTO.Coroutines)
`
653
``
`-
FPM.addPass(CoroElidePass());
`
``
651
`+
FPM.addPass(CoroElidePass());
`
654
652
``
655
653
`for (auto &C : ScalarOptimizerLateEPCallbacks)
`
656
654
`C(FPM, Level);
`
`@@ -847,8 +845,7 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
`
847
845
`LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap),
`
848
846
` EnableMSSALoopDependency, /UseBlockFrequencyInfo=/true));
`
849
847
``
850
``
`-
if (PTO.Coroutines)
`
851
``
`-
FPM.addPass(CoroElidePass());
`
``
848
`+
FPM.addPass(CoroElidePass());
`
852
849
``
853
850
`for (auto &C : ScalarOptimizerLateEPCallbacks)
`
854
851
`C(FPM, Level);
`
`@@ -1027,8 +1024,7 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
`
1027
1024
` MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
`
1028
1025
`buildFunctionSimplificationPipeline(Level, Phase)));
`
1029
1026
``
1030
``
`-
if (PTO.Coroutines)
`
1031
``
`-
MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
`
``
1027
`+
MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
`
1032
1028
``
1033
1029
`return MIWP;
`
1034
1030
`}
`
`@@ -1083,8 +1079,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
`
1083
1079
` EarlyFPM.addPass(SimplifyCFGPass());
`
1084
1080
` EarlyFPM.addPass(SROA());
`
1085
1081
` EarlyFPM.addPass(EarlyCSEPass());
`
1086
``
`-
if (PTO.Coroutines)
`
1087
``
`-
EarlyFPM.addPass(CoroEarlyPass());
`
``
1082
`+
EarlyFPM.addPass(CoroEarlyPass());
`
1088
1083
`if (Level == OptimizationLevel::O3)
`
1089
1084
` EarlyFPM.addPass(CallSiteSplittingPass());
`
1090
1085
``
`@@ -1451,8 +1446,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
`
1451
1446
`// resulted in single-entry-single-exit or empty blocks. Clean up the CFG.
`
1452
1447
` OptimizePM.addPass(SimplifyCFGPass());
`
1453
1448
``
1454
``
`-
if (PTO.Coroutines)
`
1455
``
`-
OptimizePM.addPass(CoroCleanupPass());
`
``
1449
`+
OptimizePM.addPass(CoroCleanupPass());
`
1456
1450
``
1457
1451
`// Add the core optimizing pipeline.
`
1458
1452
` MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
`
`@@ -1562,8 +1556,7 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
`
1562
1556
`// Module simplification splits coroutines, but does not fully clean up
`
1563
1557
`// coroutine intrinsics. To ensure ThinLTO optimization passes don't trip up
`
1564
1558
`// on these, we schedule the cleanup here.
`
1565
``
`-
if (PTO.Coroutines)
`
1566
``
`-
MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
`
``
1559
`+
MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
`
1567
1560
``
1568
1561
`if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
`
1569
1562
` MPM.addPass(PseudoProbeUpdatePass());
`
`@@ -1937,10 +1930,8 @@ ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
`
1937
1930
`// which is just that always inlining occurs. Further, disable generating
`
1938
1931
`// lifetime intrinsics to avoid enabling further optimizations during
`
1939
1932
`// code generation.
`
1940
``
`-
// However, we need to insert lifetime intrinsics to avoid invalid access
`
1941
``
`-
// caused by multithreaded coroutines.
`
1942
1933
` MPM.addPass(AlwaysInlinerPass(
`
1943
``
`-
/InsertLifetimeIntrinsics=/PTO.Coroutines));
`
``
1934
`+
/InsertLifetimeIntrinsics=/false));
`
1944
1935
``
1945
1936
`if (PTO.MergeFunctions)
`
1946
1937
` MPM.addPass(MergeFunctionsPass());
`
`@@ -1989,15 +1980,11 @@ ModulePassManager PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
`
1989
1980
` MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
`
1990
1981
` }
`
1991
1982
``
1992
``
`-
if (PTO.Coroutines) {
`
1993
``
`-
MPM.addPass(createModuleToFunctionPassAdaptor(CoroEarlyPass()));
`
1994
``
-
1995
``
`-
CGSCCPassManager CGPM;
`
1996
``
`-
CGPM.addPass(CoroSplitPass());
`
1997
``
`-
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
`
1998
``
-
1999
``
`-
MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
`
2000
``
`-
}
`
``
1983
`+
MPM.addPass(createModuleToFunctionPassAdaptor(CoroEarlyPass()));
`
``
1984
`+
CGSCCPassManager CGPM;
`
``
1985
`+
CGPM.addPass(CoroSplitPass());
`
``
1986
`+
MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
`
``
1987
`+
MPM.addPass(createModuleToFunctionPassAdaptor(CoroCleanupPass()));
`
2001
1988
``
2002
1989
`for (auto &C : OptimizerLastEPCallbacks)
`
2003
1990
`C(MPM, Level);
`