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

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Wed Jan 10 22:50:07 PST 2024


================
@@ -959,8 +959,12 @@ void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S,
 
   unsigned Counter = (*RegionCounterMap)[S];
 
-  llvm::Value *Args[] = {FuncNameVar,
-                         Builder.getInt64(FunctionHash),
+  // Make sure that pointer to global is passed in with zero addrspace
+  // This is relevant during GPU profiling
+  auto *NormalizedPtr = llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+      FuncNameVar, llvm::PointerType::getUnqual(CGM.getLLVMContext()));
----------------
arsenm wrote:

But generic is a language concept, which doesn't necessarily map to IR AS0. Technically you should go through the language addrspace map 

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


More information about the libc-commits mailing list