[PATCH] D130142: [Coroutines] Introduce @llvm.coro.tls.wrapper to block optimizations

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 21:03:24 PDT 2022


ChuanqiXu created this revision.
ChuanqiXu added reviewers: rjmccall, jyknight, nhaehnle, efriedma, nikic, ychen.
ChuanqiXu added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.

This is the original idea to solve the TLS problem in coroutines described in https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015.

The main discussion of the thread is about how should we handle `readnone` attribute and this is already done in D127383 <https://reviews.llvm.org/D127383>. The here is the other problem about TLS variables.

@jyknight points out that we could solve this problem and the `TLS is not a constant` problem in one shot and we get in consensus this is the good direction. So I sent D125291 <https://reviews.llvm.org/D125291> and D129833 <https://reviews.llvm.org/D129833>.

But now clang15 branch is going to be created in the next week and D125291 <https://reviews.llvm.org/D125291> has no hopes to land before that. It implies that the TLS bug would remain in clang15. I think it is really a pity that the bug has lived for 2 years.

@rjmccall sent concerns about the automatically merge of TLS addresses so that CoroEarly might not be early enough. But both of us failed to give an example. My thought is that the current one might not be perfect and D125291 <https://reviews.llvm.org/D125291> should be the direction in the future. And the current one is simple enough and workable in most cases. I think we could land this first to fix the bug. I would revert this one if D125291 <https://reviews.llvm.org/D125291> or any other similar patches get landed. How do you think about the strategy?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130142

Files:
  llvm/docs/Coroutines.rst
  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-cleanup.ll
  llvm/test/Transforms/Coroutines/coro-TLS-early.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130142.446032.patch
Type: text/x-patch
Size: 15766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220720/8cd1c625/attachment.bin>


More information about the llvm-commits mailing list