aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2015-07-13 22:54:53 +0000
committerSamuel Antao <sfantao@us.ibm.com>2015-07-13 22:54:53 +0000
commitf8b5012dfb5210d616d838a558a5dccd7f8f6aae (patch)
treefa1748382ae9c4e1ba45546c3504fa93d73b9a55 /clang/lib/CodeGen/CodeGenModule.cpp
parent6c40c5e0311539fcfea9bd5ef6e2330d5c4f2199 (diff)
downloadllvm-f8b5012dfb5210d616d838a558a5dccd7f8f6aae.zip
llvm-f8b5012dfb5210d616d838a558a5dccd7f8f6aae.tar.gz
llvm-f8b5012dfb5210d616d838a558a5dccd7f8f6aae.tar.bz2
[OpenMP] Add TLS-based implementation for threadprivate directive.
llvm-svn: 242080
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index b905bd2..a179ad4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1262,6 +1262,11 @@ bool CodeGenModule::MayBeEmittedEagerly(const ValueDecl *Global) {
// Implicit template instantiations may change linkage if they are later
// explicitly instantiated, so they should not be emitted eagerly.
return false;
+ // If OpenMP is enabled and threadprivates must be generated like TLS, delay
+ // codegen for global variables, because they may be marked as threadprivate.
+ if (LangOpts.OpenMP && LangOpts.OpenMPUseTLS &&
+ getContext().getTargetInfo().isTLSSupported() && isa<VarDecl>(Global))
+ return false;
return true;
}