1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/lib/Passes
Xun Li 791eaad746 [Coroutines] Add the newly generated SCCs back to the CGSCC work queue after CoroSplit actually happened
Relevant discussion can be found at: https://lists.llvm.org/pipermail/llvm-dev/2021-January/148197.html
In the existing design, An SCC that contains a coroutine will go through the folloing passes:
Inliner -> CoroSplitPass (fake) -> FunctionSimplificationPipeline -> Inliner -> CoroSplitPass (real) -> FunctionSimplificationPipeline

The first CoroSplitPass doesn't do anything other than putting the SCC back to the queue so that the entire pipeline can repeat.
As you can see, we run Inliner twice on the SCC consecutively without doing any real split, which is unnecessary and likely unintended.
What we really wanted is this:
Inliner -> FunctionSimplificationPipeline -> CoroSplitPass -> FunctionSimplificationPipeline
(note that we don't really need to run Inliner again on the ramp function after split).

Hence the way we do it here is to move CoroSplitPass to the end of the CGSCC pipeline, make it once for real, insert the newly generated SCCs (the clones) back to the pipeline so that they can be optimized, and also add a function simplification pipeline after CoroSplit to optimize the post-split ramp function.

This approach also conforms to how the new pass manager works instead of relying on an adhoc post split cleanup, making it ready for full switch to new pass manager eventually.

By looking at some of the changes to the tests, we can already observe that this changes allows for more optimizations applied to coroutines.

Reviewed By: aeubanks, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D95807
2021-06-30 11:38:14 -07:00
..
CMakeLists.txt [NewPM] Add C bindings for new pass manager 2021-05-17 11:45:47 -07:00
PassBuilder.cpp [Coroutines] Add the newly generated SCCs back to the CGSCC work queue after CoroSplit actually happened 2021-06-30 11:38:14 -07:00
PassBuilderBindings.cpp [NewPM] Add C bindings for new pass manager 2021-05-17 11:45:47 -07:00
PassPlugin.cpp [NPM] Resolve llvmGetPassPluginInfo to the plugin being loaded 2021-06-30 18:11:28 +01:00
PassRegistry.def [NewPM] Print passes with params when using "opt -print-passes" 2021-06-22 09:01:38 +02:00
StandardInstrumentations.cpp ABI breaking changes fixes. 2021-06-15 11:08:13 +01:00