================
@@ -968,8 +969,8 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
   // it's been modified since.
   MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
       RequireAnalysisPass<ShouldNotRunFunctionPassesAnalysis, Function>()));
-
   MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
+  MainCGPipeline.addPass(CoroAnnotationElidePass());
----------------
vogelsgesang wrote:

Should this optimization also work for ThinLTO? (also see discussion in 
https://github.com/llvm/llvm-project/pull/99283#discussion_r1684973257)

I read this pass setup a bit more carefully now, and I don't think it will work 
for ThinLTO.

Why?

* Both `CoroAnnotationElide` and `CoroSplit` are added to 
`buildInlinerPipeline`.
* `buildInlinerPipeline` is used by `buildModuleSimplificationPipeline`.
* `buildModuleSimplificationPipeline` is part of both 
`buildThinLTOPreLinkDefaultPipeline` and `buildThinLTODefaultPipeline`
* -> `CoroSplit` already runs as part of `buildThinLTOPreLinkDefaultPipeline` 
(i.e. on a per-translation-unit-level)
* -> by the time we reach `buildThinLTODefaultPipeline` (i.e. the cross-TU part 
of ThinLTO), the coroutines are already split
* -> although, `CoroAnnotationElide` is run a 2nd time as part of cross-TU 
optimization, it will be a no-op due to the `Caller->isPresplitCoroutine()` 
check in `CoroAnnotationElide.cpp:120`

https://github.com/llvm/llvm-project/pull/99285
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to