[PATCH] D67429: Improve code generation for thread_local variables:

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 19:06:07 PDT 2019


rsmith created this revision.
rsmith added a reviewer: rjmccall.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

- Don't bother using a thread wrapper when the variable is known to have constant initialization.
- Emit the thread wrapper as discardable-if-unused in TUs that don't contain a definition of the thread_local variable.
- Don't emit the thread wrapper at all if the thread_local variable is unused and discardable; it will be emitted by all TUs that need it.


Repository:
  rC Clang

https://reviews.llvm.org/D67429

Files:
  include/clang/Basic/Linkage.h
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGen/windows-on-arm-itanium-thread-local.c
  test/CodeGenCXX/cxx11-thread-local.cpp
  test/CodeGenCXX/cxx2a-thread-local-constinit.cpp
  test/CodeGenCXX/tls-init-funcs.cpp
  test/CodeGenCXX/windows-on-arm-itanium-thread-local.cpp
  test/OpenMP/parallel_copyin_codegen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67429.219652.patch
Type: text/x-patch
Size: 20280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190911/2ef533d2/attachment-0001.bin>


More information about the cfe-commits mailing list