[OpenMP] Add TLS-based implementation for threadprivate directive.

llvm-svn: 242080
This commit is contained in:
Samuel Antao
2015-07-13 22:54:53 +00:00
parent 6c40c5e031
commit f8b5012dfb
15 changed files with 350 additions and 46 deletions

View File

@@ -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;
}