aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenPGO.cpp
diff options
context:
space:
mode:
authorEthan Luis McDonough <ethanluismcdonough@gmail.com>2025-03-19 19:01:38 -0500
committerGitHub <noreply@github.com>2025-03-19 19:01:38 -0500
commitc50d39f073f3b0143b781be80764d183ddab88d4 (patch)
tree4e99ee2d575390d3bc3a84a940ea68ed311cd638 /clang/lib/CodeGen/CodeGenPGO.cpp
parentde2a451058730c932dd34cda8709ba64730a9124 (diff)
downloadllvm-c50d39f073f3b0143b781be80764d183ddab88d4.zip
llvm-c50d39f073f3b0143b781be80764d183ddab88d4.tar.gz
llvm-c50d39f073f3b0143b781be80764d183ddab88d4.tar.bz2
[PGO][Offload] Allow PGO flags to be used on GPU targets (#94268)
This pull request is the third part of an ongoing effort to extends PGO instrumentation to GPU device code and depends on https://github.com/llvm/llvm-project/pull/93365. This PR makes the following changes: - Allows PGO flags to be supplied to GPU targets - Pulls version global from device - Modifies `__llvm_write_custom_profile` and `lprofWriteDataImpl` to allow the PGO version to be overridden
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index 7923738..ff8b133 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -1357,6 +1357,9 @@ void CodeGenPGO::setProfileVersion(llvm::Module &M) {
IRLevelVersionVariable->setVisibility(llvm::GlobalValue::HiddenVisibility);
llvm::Triple TT(M.getTargetTriple());
+ if (TT.isAMDGPU() || TT.isNVPTX())
+ IRLevelVersionVariable->setVisibility(
+ llvm::GlobalValue::ProtectedVisibility);
if (TT.supportsCOMDAT()) {
IRLevelVersionVariable->setLinkage(llvm::GlobalValue::ExternalLinkage);
IRLevelVersionVariable->setComdat(M.getOrInsertComdat(VarName));