aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CoverageMappingGen.cpp
diff options
context:
space:
mode:
authorEthan Luis McDonough <ethanluismcdonough@gmail.com>2025-06-10 20:19:38 -0500
committerGitHub <noreply@github.com>2025-06-10 20:19:38 -0500
commit67ff66e67734c0b283ec676899e5b89b67fdafcb (patch)
tree2424be3acebc279d88caa13864fbdc2f2aa99d97 /clang/lib/CodeGen/CoverageMappingGen.cpp
parent3cef099ceddccefca8e11268624397cde9e04af6 (diff)
downloadllvm-67ff66e67734c0b283ec676899e5b89b67fdafcb.zip
llvm-67ff66e67734c0b283ec676899e5b89b67fdafcb.tar.gz
llvm-67ff66e67734c0b283ec676899e5b89b67fdafcb.tar.bz2
[PGO][Offload] Fix offload coverage mapping (#143490)
This pull request fixes coverage mapping on GPU targets. - It adds an address space cast to the coverage mapping generation pass. - It reads the profiled function names from the ELF directly. Reading it from public globals was causing issues in cases where multiple device-code object files are linked together.
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 1788bb4..4aafac3 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -2622,8 +2622,9 @@ void CoverageMappingModuleGen::emit() {
CGM.addUsedGlobal(CovData);
// Create the deferred function records array
if (!FunctionNames.empty()) {
- auto NamesArrTy = llvm::ArrayType::get(llvm::PointerType::getUnqual(Ctx),
- FunctionNames.size());
+ auto AddrSpace = FunctionNames.front()->getType()->getPointerAddressSpace();
+ auto NamesArrTy = llvm::ArrayType::get(
+ llvm::PointerType::get(Ctx, AddrSpace), FunctionNames.size());
auto NamesArrVal = llvm::ConstantArray::get(NamesArrTy, FunctionNames);
// This variable will *NOT* be emitted to the object file. It is used
// to pass the list of names referenced to codegen.