r180004 - Don't emit _ZTW wrappers for TLS variables which don't use the C++ thread_local keyword.
Richard Smith
richard-llvm at metafoo.co.uk
Mon Apr 22 01:06:18 PDT 2013
Author: rsmith
Date: Mon Apr 22 03:06:17 2013
New Revision: 180004
URL: http://llvm.org/viewvc/llvm-project?rev=180004&view=rev
Log:
Don't emit _ZTW wrappers for TLS variables which don't use the C++ thread_local keyword.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGen/thread-specifier.c
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=180004&r1=180003&r2=180004&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Apr 22 03:06:17 2013
@@ -1479,7 +1479,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(Str
}
if (D->getTLSKind()) {
- CXXThreadLocals.push_back(std::make_pair(D, GV));
+ if (D->getTLSKind() == VarDecl::TLS_Dynamic)
+ CXXThreadLocals.push_back(std::make_pair(D, GV));
setTLSMode(GV, *D);
}
}
Modified: cfe/trunk/test/CodeGen/thread-specifier.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thread-specifier.c?rev=180004&r1=180003&r2=180004&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/thread-specifier.c (original)
+++ cfe/trunk/test/CodeGen/thread-specifier.c Mon Apr 22 03:06:17 2013
@@ -10,6 +10,9 @@
// CHECK: @i = thread_local(initialexec) global
// CHECK: @j = thread_local(localexec) global
+// CHECK-NOT: @_ZTW
+// CHECK-NOT: @_ZTH
+
__thread int a;
extern __thread int b;
int c() { return *&b; }
More information about the cfe-commits
mailing list