================
@@ -1407,6 +1420,26 @@ void CGNVCUDARuntime::emitOffloadProfilingSections() {
M, PtrTy, /*isConstant=*/false, llvm::GlobalValue::ExternalLinkage,
llvm::ConstantPointerNull::get(PtrTy), Name);
CGM.addCompilerUsedGlobal(OffloadProfShadow);
+
+ auto AddSectionShadow = [&](StringRef Kind, const Twine &DeviceName) {
+ std::string ShadowName =
+ (Twine("__llvm_profile_shadow_") + Kind + "_" + CUIDHash + "_" +
+ Twine(OffloadProfSectionShadows.size()))
+ .str();
+ auto *Shadow = new llvm::GlobalVariable(
+ M, PtrTy, /*isConstant=*/false, llvm::GlobalValue::ExternalLinkage,
+ llvm::ConstantPointerNull::get(PtrTy), ShadowName);
+ CGM.addCompilerUsedGlobal(Shadow);
+ OffloadProfSectionShadows.push_back({Shadow, DeviceName.str()});
+ };
+
+ for (auto &&I : EmittedKernels) {
----------------
lfmeadow wrote:
Fragile encoding/decoding, see comment above on
__llvm_profile_offload_register_section_shadow_variable. Order must be th same,
at least put some comments.
https://github.com/llvm/llvm-project/pull/202095
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits