[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:25 PDT 2026


================
@@ -774,6 +784,27 @@ llvm::Function *CGNVCUDARuntime::makeRegisterGlobalsFn() {
     Builder.CreateCall(RegisterShadow, {OffloadProfShadow});
   }
 
+  if (!OffloadProfSectionShadows.empty()) {
+    llvm::FunctionCallee RegisterSectionShadow = CGM.CreateRuntimeFunction(
+        llvm::FunctionType::get(VoidTy, {PtrTy}, false),
+        "__llvm_profile_offload_register_section_shadow_variable");
+    for (const auto &Info : OffloadProfSectionShadows) {
+      llvm::Constant *Name = makeConstantString(Info.DeviceName);
+      llvm::Value *RegisterVarArgs[] = {
+          &GpuBinaryHandlePtr,
+          Info.Shadow,
+          Name,
+          Name,
+          llvm::ConstantInt::get(IntTy, /*Extern=*/0),
+          llvm::ConstantInt::get(VarSizeTy,
+                                 CGM.getDataLayout().getPointerSize()),
+          llvm::ConstantInt::get(IntTy, /*Constant=*/0),
----------------
arsenm wrote:

```suggestion
          llvm::ConstantInt::get(IntTy, 0),
```

This is also called 3 times?

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


More information about the cfe-commits mailing list