[PATCH] D124361: [Coroutines] Add coro_maychange intrinsic to solve TLS problem (2/5)
Chuanqi Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 00:31:40 PDT 2022
ChuanqiXu created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.
This is intended to fix the TLS problem in coroutine described in https://github.com/llvm/llvm-project/issues/47179
Simply, we would assume the address of a TLS variable is same in one function. Since a function should be executed in one thread only. However, it is not true for unlowered coroutine. This patch tries to fix the problem by adding a wrapper for every TLS variable to block the alias analysis. Note that we couldn't do this for unlowered coroutine only due to inlining. Also the compiler is still available to optimize TLS variables for lowered coroutine.
https://reviews.llvm.org/D124361
Files:
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
llvm/lib/Transforms/Coroutines/CoroEarly.cpp
llvm/lib/Transforms/Coroutines/Coroutines.cpp
llvm/test/Transforms/Coroutines/coro-TLS-01.ll
llvm/test/Transforms/Coroutines/coro-TLS-02.ll
llvm/test/Transforms/Coroutines/coro-TLS-03.ll
llvm/test/Transforms/Coroutines/coro-TLS-04.ll
llvm/test/Transforms/Coroutines/coro-cleanup-maychange.ll
llvm/test/Transforms/Coroutines/coro-early-maychange.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124361.424829.patch
Type: text/x-patch
Size: 17092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/035040d9/attachment.bin>
More information about the llvm-commits
mailing list