[clang] [compiler-rt] [llvm] [PGO][HIP] Fix HIP device profile collection and sections emission (PR #202095)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 02:25:26 PDT 2026


================
@@ -1311,13 +1342,23 @@ void CGNVCUDARuntime::createOffloadingEntries() {
     llvm::FunctionCallee RegisterShadow = CGM.CreateRuntimeFunction(
         llvm::FunctionType::get(VoidTy, {PtrTy}, false),
         "__llvm_profile_offload_register_shadow_variable");
+    llvm::FunctionCallee RegisterSectionShadow = CGM.CreateRuntimeFunction(
+        llvm::FunctionType::get(VoidTy, {PtrTy}, false),
+        "__llvm_profile_offload_register_section_shadow_variable");
     auto *CtorFn = llvm::Function::Create(
         llvm::FunctionType::get(VoidTy, false),
         llvm::GlobalValue::InternalLinkage,
         "__llvm_profile_register_shadow." + CGM.getContext().getCUIDHash(), &M);
     auto *Entry = llvm::BasicBlock::Create(Ctx, "entry", CtorFn);
     llvm::IRBuilder<> B(Entry);
     B.CreateCall(RegisterShadow, {OffloadProfShadow});
+    for (const auto &Info : OffloadProfSectionShadows) {
+      llvm::offloading::emitOffloadingEntry(
+          M, Kind, Info.Shadow, Info.DeviceName,
+          CGM.getDataLayout().getPointerSize(),
----------------
arsenm wrote:

Don't use default argument for getPointerSize 

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


More information about the cfe-commits mailing list