[PATCH] D125291: Introduce @llvm.threadlocal.address intrinsic to access TLS variable

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 02:36:38 PDT 2022


nikic added a comment.

In D125291#3548671 <https://reviews.llvm.org/D125291#3548671>, @jyknight wrote:

> Anyhow -- I think the prototype I'm fiddling with is also along the path to the ideal long-term state, but pushing it beyond a prototype seems like it'll be a pain in the ass due to the bitcode compatibility requirement. (The bitcode upgrader would need to know how to transform all constant expressions using a TLS global into non-constant IR instructions, starting with a call to llvm.threadlocal.address -- in every function where the "constant" is referenced. For uses outside a function body, it transforms to an arbitrary address (e.g. null), instead.)

I have implemented support for converting constant expressions to instructions in the bitcode reader in https://reviews.llvm.org/D127729. This was originally intended for constant expression removal, but I think with that infrastructure in place, upgrading TLS global references to use an intrinsic would be fairly simple.


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

https://reviews.llvm.org/D125291



More information about the llvm-commits mailing list