[libc-commits] [lldb] [compiler-rt] [clang-tools-extra] [openmp] [flang] [libc] [lld] [llvm] [libcxx] [clang] [PGO][OpenMP] Instrumentation for GPU devices (PR #76587)

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Mon Jan 8 22:35:51 PST 2024


================
@@ -448,8 +456,12 @@ GlobalVariable *createPGOFuncNameVar(Module &M,
       new GlobalVariable(M, Value->getType(), true, Linkage, Value,
                          getPGOFuncNameVarName(PGOFuncName, Linkage));
 
+  // If the target is a GPU, make the symbol protected so it can
+  // be read from the host device
+  if (isGPUProfTarget(M))
+    FuncNameVar->setVisibility(GlobalValue::ProtectedVisibility);
   // Hide the symbol so that we correctly get a copy for each executable.
-  if (!GlobalValue::isLocalLinkage(FuncNameVar->getLinkage()))
+  else if (!GlobalValue::isLocalLinkage(FuncNameVar->getLinkage()))
     FuncNameVar->setVisibility(GlobalValue::HiddenVisibility);
----------------
arsenm wrote:

Can you spot this into some kind of function-to-visibility to use function? This doesn't feel like the right way to control it, so might as well cleanly separate it out 

https://github.com/llvm/llvm-project/pull/76587


More information about the libc-commits mailing list