[all-commits] [llvm/llvm-project] 822b92: [Coroutines] Add the newly generated SCCs back to ...
Xun Li via All-commits
all-commits at lists.llvm.org
Wed Jun 30 11:38:27 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 822b92aae439c4ba2946980c8a27bd2c8a62d90c
https://github.com/llvm/llvm-project/commit/822b92aae439c4ba2946980c8a27bd2c8a62d90c
Author: Xun Li <lxfind at gmail.com>
Date: 2021-06-30 (Wed, 30 Jun 2021)
Changed paths:
M clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp
M llvm/lib/Passes/PassBuilder.cpp
M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
M llvm/test/Transforms/Coroutines/ArgAddr.ll
M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O0.ll
M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O2.ll
M llvm/test/Transforms/Coroutines/coro-alloca-01.ll
M llvm/test/Transforms/Coroutines/coro-alloca-02.ll
M llvm/test/Transforms/Coroutines/coro-alloca-03.ll
M llvm/test/Transforms/Coroutines/coro-alloca-04.ll
M llvm/test/Transforms/Coroutines/coro-alloca-05.ll
M llvm/test/Transforms/Coroutines/coro-alloca-06.ll
M llvm/test/Transforms/Coroutines/coro-alloca-07.ll
M llvm/test/Transforms/Coroutines/coro-alloca-08.ll
M llvm/test/Transforms/Coroutines/coro-async.ll
M llvm/test/Transforms/Coroutines/coro-byval-param.ll
M llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
M llvm/test/Transforms/Coroutines/coro-catchswitch.ll
M llvm/test/Transforms/Coroutines/coro-debug.ll
M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-00.ll
M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-01.ll
M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-02.ll
M llvm/test/Transforms/Coroutines/coro-frame-arrayalloca.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
M llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
M llvm/test/Transforms/Coroutines/coro-frame.ll
M llvm/test/Transforms/Coroutines/coro-materialize.ll
M llvm/test/Transforms/Coroutines/coro-padding.ll
M llvm/test/Transforms/Coroutines/coro-param-copy.ll
M llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll
M llvm/test/Transforms/Coroutines/coro-retcon-frame.ll
M llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll
M llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
M llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll
M llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll
M llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
M llvm/test/Transforms/Coroutines/coro-retcon-value.ll
M llvm/test/Transforms/Coroutines/coro-retcon.ll
M llvm/test/Transforms/Coroutines/coro-spill-after-phi.ll
M llvm/test/Transforms/Coroutines/coro-spill-corobegin.ll
M llvm/test/Transforms/Coroutines/coro-spill-defs-before-corobegin.ll
M llvm/test/Transforms/Coroutines/coro-spill-promise.ll
M llvm/test/Transforms/Coroutines/coro-split-00.ll
M llvm/test/Transforms/Coroutines/coro-split-02.ll
M llvm/test/Transforms/Coroutines/coro-split-alloc.ll
M llvm/test/Transforms/Coroutines/coro-split-dbg.ll
M llvm/test/Transforms/Coroutines/coro-split-eh-00.ll
M llvm/test/Transforms/Coroutines/coro-split-eh-01.ll
M llvm/test/Transforms/Coroutines/coro-split-hidden.ll
M llvm/test/Transforms/Coroutines/coro-split-musttail.ll
M llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
M llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
M llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
M llvm/test/Transforms/Coroutines/coro-split-recursive.ll
M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-01.ll
M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-03.ll
M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-04.ll
M llvm/test/Transforms/Coroutines/coro-swifterror.ll
M llvm/test/Transforms/Coroutines/coro-zero-alloca.ll
M llvm/test/Transforms/Coroutines/no-suspend.ll
M llvm/test/Transforms/Coroutines/restart-trigger.ll
M llvm/test/Transforms/Coroutines/smoketest.ll
Log Message:
-----------
[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
More information about the All-commits
mailing list