[PATCH] D72399: [Support] Replace Windows __declspec(thread) with thread_local in LLVM_THREAD_LOCAL

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 14:24:50 PST 2020


rnk added a comment.

In D72399#1821475 <https://reviews.llvm.org/D72399#1821475>, @russell.gallop wrote:

> > Honestly, if `__thread` is available, I wonder if LLVM should prefer that, since it implements the check that the variable is trivially constructible/destructible. But, that has no bearing on which declspec to use.
>
> Is "trivially constructible/destructible" actually a requirement for this? I thought that restriction was due to host platforms which didn't support C++11 thread_local (hence if/when every platform supported C++11 thread_local then the restriction would go away).


Yes, LLVM still supports platforms which do not support C++11 thread_local, so for LLVM, there is still a requirement that things be trivially constructible/destructible. If we used `__thread` when available, the compiler would enforce that check earlier, rather than letting the contributor commit, push, and find out about this requirement from a buildbot.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72399





More information about the llvm-commits mailing list