summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGOpenMPRuntime.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-09-23 15:53:51 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-09-23 15:53:51 +0000
commit4db9dc6f8109aed80628632f29f6c3a578be41dd (patch)
treeb55594f25e70af29a3e674827457ad9d0ea20cfb /clang/lib/CodeGen/CGOpenMPRuntime.cpp
parent6784a3cd793ad0de08896caa358a2d481b9e0c44 (diff)
downloadbcm5719-llvm-4db9dc6f8109aed80628632f29f6c3a578be41dd.tar.gz
bcm5719-llvm-4db9dc6f8109aed80628632f29f6c3a578be41dd.zip
[OPENMP]Fix PR43355: DO not emit target calls if only -fopenmp-targets
is not provided. We should not emit any target-dependent code if only -fopenmp flag is used and device targets are not provided to prevent compiler crash. llvm-svn: 372623
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 46a9ec3ac2d..b56701f40ad 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -2815,6 +2815,8 @@ llvm::Function *CGOpenMPRuntime::emitThreadPrivateVarDefinition(
bool CGOpenMPRuntime::emitDeclareTargetVarDefinition(const VarDecl *VD,
llvm::GlobalVariable *Addr,
bool PerformInit) {
+ if (CGM.getLangOpts().OMPTargetTriples.empty())
+ return false;
Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res =
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD);
if (!Res || *Res == OMPDeclareTargetDeclAttr::MT_Link ||
@@ -9718,6 +9720,8 @@ CGOpenMPRuntime::registerTargetFirstprivateCopy(CodeGenFunction &CGF,
void CGOpenMPRuntime::registerTargetGlobalVariable(const VarDecl *VD,
llvm::Constant *Addr) {
+ if (CGM.getLangOpts().OMPTargetTriples.empty())
+ return;
llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res =
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD);
if (!Res) {
OpenPOWER on IntegriCloud