[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
Tue May 24 13:03:45 PDT 2022


nhaehnle added a comment.

You can use the "Edit Related Revisions" option in the right-hand side menu of Phabricator to link this revision with the others of the series. I can't really speak for the Clang parts, but the LLVM parts looks reasonable to me modulo some detail comments.



================
Comment at: llvm/docs/LangRef.rst:24392-24403
+Overview:
+""""""""""
+
+The LLVM treated the address of thread local variable as a constant expression.
+But it is not true. The ``llvm.threadlocal.address`` intrinsic would represent
+the address of the thread local variable.
+
----------------
LangRef should be written in present tense. Something like:

> The address of a thread local variable is not a constant, since it depends on the calling thread. The ``llvm.threadlocal.address`` intrinsic returns the address of the given thread local variable in the calling thread.


================
Comment at: llvm/include/llvm/IR/IRBuilder.h:746-747
 
+  /// Create a call to llvm.threadlocal.address intrinsic.
+  CallInst *CreateThreadLocalAddress(Value *Ptr);
+
----------------
This could be a `GlobalValue*` operand to reduce the risk of misuse, right?


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

https://reviews.llvm.org/D125291



More information about the cfe-commits mailing list