Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang][PGO] Fix profile function visibility bug #127257

Merged

Conversation

EthanLuisMcDonough
Copy link
Member

@EthanLuisMcDonough EthanLuisMcDonough commented Feb 14, 2025

This pull request fixes an issue that was introduced in #93365. __llvm_write_custom_profile visibility was causing issues on Darwin. This function needs to be publicly accessible in order to be accessed by libomptarget, so this pull request makes __llvm_write_custom_profile an explicitly exported symbol on Darwin. Tested on M3 and X86 macs.

@llvmbot llvmbot added compiler-rt PGO Profile Guided Optimizations labels Feb 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 14, 2025

@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-pgo

Author: Ethan Luis McDonough (EthanLuisMcDonough)

Changes

This pull request fixes an issue that was introduced in #93365. __llvm_write_custom_profile visibility was causing issues on Darwin.


Full diff: https://github.com/llvm/llvm-project/pull/127257.diff

1 Files Affected:

  • (modified) compiler-rt/lib/profile/InstrProfilingFile.c (+4-6)
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 503d159fd9817..673cb9a5208bb 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -1362,12 +1362,10 @@ COMPILER_RT_VISIBILITY int __llvm_profile_set_file_object(FILE *File,
   return 0;
 }
 
-int __llvm_write_custom_profile(const char *Target,
-                                const __llvm_profile_data *DataBegin,
-                                const __llvm_profile_data *DataEnd,
-                                const char *CountersBegin,
-                                const char *CountersEnd, const char *NamesBegin,
-                                const char *NamesEnd) {
+COMPILER_RT_VISIBILITY int __llvm_write_custom_profile(
+    const char *Target, const __llvm_profile_data *DataBegin,
+    const __llvm_profile_data *DataEnd, const char *CountersBegin,
+    const char *CountersEnd, const char *NamesBegin, const char *NamesEnd) {
   int ReturnValue = 0, FilenameLength, TargetLength;
   char *FilenameBuf, *TargetFilename;
   const char *Filename;

@EthanLuisMcDonough EthanLuisMcDonough marked this pull request as draft February 15, 2025 09:43
@EthanLuisMcDonough EthanLuisMcDonough changed the title [PGO][Offload] Fix profile function visibility [Darwin][PGO] Fix profile function visibility bug Feb 16, 2025
@EthanLuisMcDonough EthanLuisMcDonough marked this pull request as ready for review February 16, 2025 09:38
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Feb 16, 2025
@EthanLuisMcDonough EthanLuisMcDonough changed the title [Darwin][PGO] Fix profile function visibility bug [Clang][PGO] Fix profile function visibility bug Feb 16, 2025
Copy link
Contributor

@qiongsiwu qiongsiwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ethan! LGTM!

@EthanLuisMcDonough EthanLuisMcDonough merged commit 83e180c into llvm:main Feb 17, 2025
12 checks passed
YutongZhuu pushed a commit to YutongZhuu/llvm-project that referenced this pull request Mar 8, 2025
This pull request fixes an issue that was introduced in llvm#93365.
`__llvm_write_custom_profile` visibility was causing issues on Darwin.
This function needs to be publicly accessible in order to be accessed by
libomptarget, so this pull request makes `__llvm_write_custom_profile`
an explicitly exported symbol on Darwin. Tested on M3 and X86 macs.
YutongZhuu pushed a commit to YutongZhuu/llvm-project that referenced this pull request Mar 8, 2025
This pull request fixes an issue that was introduced in llvm#93365.
`__llvm_write_custom_profile` visibility was causing issues on Darwin.
This function needs to be publicly accessible in order to be accessed by
libomptarget, so this pull request makes `__llvm_write_custom_profile`
an explicitly exported symbol on Darwin. Tested on M3 and X86 macs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category compiler-rt PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants