aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp17
-rw-r--r--clang/test/OpenMP/declare_target_codegen.cpp2
2 files changed, 8 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 7a4c2a8..d301a4c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6799,16 +6799,13 @@ public:
if (const auto *VD =
dyn_cast_or_null<VarDecl>(I->getAssociatedDeclaration())) {
if (llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res =
- isDeclareTargetDeclaration(VD)) {
- assert(*Res == OMPDeclareTargetDeclAttr::MT_Link &&
- "Declare target link is expected.");
- // Avoid warning in release build.
- (void)*Res;
- IsLink = true;
- BP = CGF.CGM.getOpenMPRuntime()
- .getAddrOfDeclareTargetLink(VD)
- .getPointer();
- }
+ isDeclareTargetDeclaration(VD))
+ if (*Res == OMPDeclareTargetDeclAttr::MT_Link) {
+ IsLink = true;
+ BP = CGF.CGM.getOpenMPRuntime()
+ .getAddrOfDeclareTargetLink(VD)
+ .getPointer();
+ }
}
// If the variable is a pointer and is being dereferenced (i.e. is not
diff --git a/clang/test/OpenMP/declare_target_codegen.cpp b/clang/test/OpenMP/declare_target_codegen.cpp
index ad6718c6..86c0c02 100644
--- a/clang/test/OpenMP/declare_target_codegen.cpp
+++ b/clang/test/OpenMP/declare_target_codegen.cpp
@@ -45,7 +45,7 @@ int maini1() {
static long aa = 32;
// CHECK-DAG: define void @__omp_offloading_{{.*}}maini1{{.*}}_l[[@LINE+1]](i32* dereferenceable{{.*}}, i64 {{.*}}, i64 {{.*}})
#pragma omp target map(tofrom \
- : a)
+ : a, b)
{
static long aaa = 23;
a = foo() + bar() + b + c + d + aa + aaa;