[llvm] CodeGenPrepare: Remove threadlocal_address intrinsic when cheap to recompute. (PR #87844)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 19:27:15 PDT 2024


nikic wrote:

I agree with @jyknight that we should avoid dropping the threadlocal.address intrinsics in this way. The long-term plan for TLS was to change TLS globals to return a token value, and make threadlocal.address accept that token and return the actual pointer. This change wouldn't be compatible with that, as we'd replace the pointer with the token.

You do need to address this in CGP, but I'd expect it to be in the same way as we do it for address calculations in general: By duplicating/sinking. Possibly this is something that should be directly integrated in the address mode logic (as this is ultimately about address modes), but if nothing else you can duplicate the threadlocal.address intrinsics separately.

https://github.com/llvm/llvm-project/pull/87844


More information about the llvm-commits mailing list