[OPENMP] Do not consider address constant vars as possibly

threadprivate.

Do not delay emission of the address constant variables in OpenMP mode
as they cannot be defined as threadprivate.

llvm-svn: 335483
This commit is contained in:
Alexey Bataev
2018-06-25 15:32:05 +00:00
parent 32287ad897
commit 96edb2e37e
2 changed files with 31 additions and 1 deletions

View File

@@ -1914,7 +1914,8 @@ bool CodeGenModule::MayBeEmittedEagerly(const ValueDecl *Global) {
// 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))
getContext().getTargetInfo().isTLSSupported() && isa<VarDecl>(Global) &&
!isTypeConstant(Global->getType(), false))
return false;
return true;