[PATCH] D92661: [RFC] Fix TLS and Coroutine

Hongtao Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 13:38:11 PST 2020


hoy added inline comments.


================
Comment at: llvm/include/llvm/IR/Intrinsics.td:1309
+// Intrinsic to obtain the address of a thread_local variable.
+def int_threadlocal : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty]>;
+
----------------
lxfind wrote:
> hoy wrote:
> > hoy wrote:
> > > With the intrinsic, can TLS variable reference in the same coroutine or regular routine be DCE-ed anymore?
> > Sorry, I meant CSE-ed.
> Since the intrinsics does not have readnone attribute, it won't be CSE-ed before CoroSplit.
> However after CoroSplit, it will be lowered back to the direct reference of the TLS, and will be CSE-ed by latter passes.
> I can add a test function to demonstrate that too.
Sounds good. Can you please point out what optimization passes CSE-ed tls reference without this implementation? I'm wondering if those optimizations can be postponed to after CoroSplit. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92661/new/

https://reviews.llvm.org/D92661



More information about the cfe-commits mailing list