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

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 23:45:25 PDT 2022


ChuanqiXu marked 2 inline comments as done.
ChuanqiXu 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);
+
----------------
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.


================
Comment at: llvm/include/llvm/IR/Intrinsics.td:1393-1394
 
+def int_threadlocal_address : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty],
+                                        [IntrNoMem, IntrWillReturn]>;
+
----------------
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.


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

https://reviews.llvm.org/D125291



More information about the cfe-commits mailing list