[PATCH] D125291: Introduce @llvm.threadlocal.address intrinsic to access TLS variable (1/3)

Nicolai Hähnle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 08:46:41 PDT 2022


nhaehnle added inline comments.


================
Comment at: llvm/include/llvm/IR/IRBuilder.h:746-747
 
+  /// Create a call to llvm.threadlocal.address intrinsic.
+  CallInst *CreateThreadLocalAddress(Value *Ptr);
+
----------------
ChuanqiXu wrote:
> nhaehnle wrote:
> > This could be a `GlobalValue*` operand to reduce the risk of misuse, right?
> We could use `Value*` here to keep consistency with other functions and the uses. We added assertion in implementations to avoid misuses.
Thanks!


================
Comment at: llvm/include/llvm/IR/Intrinsics.td:1393-1394
 
+def int_threadlocal_address : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty],
+                                        [IntrNoMem, IntrWillReturn]>;
+
----------------
ChuanqiXu wrote:
> nhaehnle wrote:
> > Whether IntrNoMem is truly correct here depends on the overall solution of the thread identification issue, i.e. it depends on whether readnone implies "doesn't read thread ID". We'd best discuss that separately.
> Yeah, let's discuss this in discourse thread.
Just to follow up, based on the latest comments including that of @jyknight, IntroNoMem is correct.


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

https://reviews.llvm.org/D125291



More information about the cfe-commits mailing list