[PATCH] D75664: [Coroutines] Also check lifetime intrinsic for local variable when build coroutine frame
JunMa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 5 00:03:20 PST 2020
junparser created this revision.
junparser added reviewers: modocache, wenlei, lewissbaker.
Herald added subscribers: llvm-commits, hiraditya, EricWF.
Herald added a project: LLVM.
Currently we move all allocas into the frame when build coroutine frame in CoroSplit pass. However, this can be relaxed.
Since CoroSplit pass run after Inline pass, we can use lifetime intrinsic to do such analysis: If the scope of lifetime intrinsic is
not across any suspend point, rather than move the allocas to frame, we can just move them to entry bb of corresponding function. This reduce the frame size.
More importantly, this also avoid data race in multithread environment. Consider one inline function by coroutine: it starts a thread which access local variables, while after inline the movement of allocs to frame also access them. cause data race.
TestPlan: check-llvm, cppcoro
https://reviews.llvm.org/D75664
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-split-02.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75664.248402.patch
Type: text/x-patch
Size: 4511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200305/d73150c5/attachment.bin>
More information about the llvm-commits
mailing list