[PGO][Offload] Fix missing names bug in GPU PGO (#166444)

After #163011 was merged, the tests in
[`offload/test/offloading/gpupgo`](https://github.com/llvm/llvm-project/compare/main...EthanLuisMcDonough:llvm-project:gpupgo-names-fix-pr?expand=1#diff-f769f6cebd25fa527bd1c1150cc64eb585c41cb8a8b325c2bc80c690e47506a1)
broke because the offload plugins were no longer able to find
`__llvm_prf_nm`. This pull request explicitly makes `__llvm_prf_nm`
visible to the host on GPU targets and reverses the changes made in
f7e9968a5b.
This commit is contained in:
Ethan Luis McDonough
2025-11-10 10:11:53 -06:00
committed by GitHub
parent b9e22ccd95
commit 38cade7cc6
5 changed files with 4 additions and 4 deletions

View File

@@ -1944,6 +1944,10 @@ void InstrLowerer::emitNameData() {
NamesVar = new GlobalVariable(M, NamesVal->getType(), true,
GlobalValue::PrivateLinkage, NamesVal,
getInstrProfNamesVarName());
if (isGPUProfTarget(M)) {
NamesVar->setLinkage(GlobalValue::ExternalLinkage);
NamesVar->setVisibility(GlobalValue::ProtectedVisibility);
}
NamesSize = CompressedNameStr.size();
setGlobalVariableLargeSection(TT, *NamesVar);

View File

@@ -18,7 +18,6 @@
// REQUIRES: amdgpu
// REQUIRES: pgo
// XFAIL: amdgpu
int test1(int a) { return a / 2; }
int test2(int a) { return a * 2; }

View File

@@ -18,7 +18,6 @@
// REQUIRES: amdgpu
// REQUIRES: pgo
// XFAIL: amdgpu
int test1(int a) { return a / 2; }

View File

@@ -50,7 +50,6 @@
// REQUIRES: amdgpu
// REQUIRES: pgo
// XFAIL: amdgpu
int main() {
int host_var = 0;

View File

@@ -16,7 +16,6 @@
// REQUIRES: amdgpu
// REQUIRES: pgo
// XFAIL: amdgpu
int test1(int a) { return a / 2; }
int test2(int a) { return a * 2; }