[PATCH] D64926: [OpenMP] Fx link clause
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 08:01:51 PDT 2019
gtbercea created this revision.
gtbercea added reviewers: ABataev, caomhin.
Herald added subscribers: cfe-commits, jdoerfert, guansong.
Herald added a project: clang.
Adjust linkage of variables under the link clause.
Repository:
rC Clang
https://reviews.llvm.org/D64926
Files:
lib/CodeGen/CGOpenMPRuntime.cpp
test/OpenMP/declare_target_link_codegen.cpp
test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp
Index: test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp
===================================================================
--- test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp
+++ test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp
@@ -31,10 +31,10 @@
}
// CHECK-HOST: [[VAR:@.+]] = global double 1.000000e+01
-// CHECK-HOST: [[VAR_DECL_TGT_LINK_PTR:@.+]] = global double* [[VAR]]
+// CHECK-HOST: [[VAR_DECL_TGT_LINK_PTR:@.+]] = weak global double* [[VAR]]
// CHECK-HOST: [[TO_VAR:@.+]] = global double 2.000000e+01
-// CHECK-HOST: [[VAR_DECL_TGT_TO_PTR:@.+]] = global double* [[TO_VAR]]
+// CHECK-HOST: [[VAR_DECL_TGT_TO_PTR:@.+]] = weak global double* [[TO_VAR]]
// CHECK-HOST: [[OFFLOAD_SIZES:@.+]] = private unnamed_addr constant [2 x i64] [i64 4, i64 8]
// CHECK-HOST: [[OFFLOAD_MAPTYPES:@.+]] = private unnamed_addr constant [2 x i64] [i64 800, i64 800]
Index: test/OpenMP/declare_target_link_codegen.cpp
===================================================================
--- test/OpenMP/declare_target_link_codegen.cpp
+++ test/OpenMP/declare_target_link_codegen.cpp
@@ -18,7 +18,7 @@
#define HEADER
// HOST-DAG: @c = external global i32,
-// HOST-DAG: @c_decl_tgt_ref_ptr = global i32* @c
+// HOST-DAG: @c_decl_tgt_ref_ptr = weak global i32* @c
// DEVICE-NOT: @c =
// DEVICE: @c_decl_tgt_ref_ptr = common global i32* null
// HOST: [[SIZES:@.+]] = private unnamed_addr constant [2 x i64] [i64 4, i64 4]
Index: lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -2572,7 +2572,7 @@
PtrName);
if (!CGM.getLangOpts().OpenMPIsDevice) {
auto *GV = cast<llvm::GlobalVariable>(Ptr);
- GV->setLinkage(llvm::GlobalValue::ExternalLinkage);
+ GV->setLinkage(llvm::GlobalValue::WeakAnyLinkage);
GV->setInitializer(CGM.GetAddrOfGlobal(VD));
}
CGM.addUsedGlobal(cast<llvm::GlobalValue>(Ptr));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64926.210571.patch
Type: text/x-patch
Size: 2053 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190718/dbab373b/attachment.bin>
More information about the cfe-commits
mailing list