diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-09-12 20:00:24 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-09-12 20:00:24 +0000 |
| commit | 00223827a952f66e7426c9881a2a4229e59bb019 (patch) | |
| tree | 7d6bebd7f9e0b0771e5e4be030d10dbaac73311f /clang/lib/CodeGen/CGExpr.cpp | |
| parent | 5806022904bc447525a02cff796c9bbbd02b0444 (diff) | |
| download | bcm5719-llvm-00223827a952f66e7426c9881a2a4229e59bb019.tar.gz bcm5719-llvm-00223827a952f66e7426c9881a2a4229e59bb019.zip | |
Improve code generation for thread_local variables:
Summary:
* 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.
Reviewers: rjmccall, jdoerfert
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D67429
llvm-svn: 371767
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index cf6dfbe76b0..9289db98c76 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2361,7 +2361,7 @@ static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF, // If it's thread_local, emit a call to its wrapper function instead. if (VD->getTLSKind() == VarDecl::TLS_Dynamic && - CGF.CGM.getCXXABI().usesThreadWrapperFunction()) + CGF.CGM.getCXXABI().usesThreadWrapperFunction(VD)) return CGF.CGM.getCXXABI().EmitThreadLocalVarDeclLValue(CGF, VD, T); // Check if the variable is marked as declare target with link clause in // device codegen. |

