[PATCH] D83379: [Coroutines] Refactor sinkLifetimeStartMarkers
JunMa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 03:43:42 PDT 2020
junparser created this revision.
junparser added reviewers: modocache, lxfind, lewissbaker.
junparser added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.
D82314 <https://reviews.llvm.org/D82314> has implemented a method for coroutine frame reducing in sinkLifetimeStartMarkers, which sink lifetime.start marker to multiple users. However, this may cause mismatch. Consider this :
coroutine A(){
a;
lifetime.start(a);
if (b)
{
... // do something
co_await
use(a);
}
use(a);
lifetime.end(a);
}
Since both user of a do not dominate each other, we just sink lifetime.start for both of them. This may cause buildCoroutineFrame to keep a as local variable. More importantly, it introduces the pattern in resume function such like:
lifetime.start(a);
use(a);
lifetime.start(a);
use(a);
lifetime.end(a);
which cause wrong optimization in later passes.
This patch rewrite sinkLifetimeStartMarkers which only sink lifetime.start markers when all of its user are only used inside one of suspended region.
TestPlan: cppcoro, check-llvm, https://godbolt.org/z/zVx_eB
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83379
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-01.ll
llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
llvm/test/Transforms/Coroutines/coro-split-sink-lifetime.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83379.276357.patch
Type: text/x-patch
Size: 12599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/ced23a89/attachment.bin>
More information about the llvm-commits
mailing list