-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Reland "[TypeProf][InstrPGO] Introduce raw and instr profile format change for type profiling. " #82703
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ject file sections
Close this PR as I should reland from original branch (main...users/minglotus-6/typeprofrawformat) to make the diff clearer. |
You can test this locally with the following command:git-clang-format --diff e899641df2391179e8ec29ca14c53b09ae7ce85c 7db72c5b5c2ef4c44182a7ae67ceea36561842ad -- compiler-rt/include/profile/InstrProfData.inc compiler-rt/lib/profile/InstrProfiling.h compiler-rt/lib/profile/InstrProfilingBuffer.c compiler-rt/lib/profile/InstrProfilingFile.c compiler-rt/lib/profile/InstrProfilingInternal.h compiler-rt/lib/profile/InstrProfilingMerge.c compiler-rt/lib/profile/InstrProfilingPlatformAIX.c compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c compiler-rt/lib/profile/InstrProfilingPlatformLinux.c compiler-rt/lib/profile/InstrProfilingPlatformOther.c compiler-rt/lib/profile/InstrProfilingPlatformWindows.c compiler-rt/lib/profile/InstrProfilingWriter.c compiler-rt/test/profile/instrprof-write-buffer-internal.c llvm/include/llvm/ProfileData/InstrProf.h llvm/include/llvm/ProfileData/InstrProfData.inc llvm/include/llvm/ProfileData/InstrProfReader.h llvm/lib/ProfileData/InstrProf.cpp llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/ProfileData/InstrProfWriter.cpp View the diff from clang-format here.diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
index 415d728871..b9d51b698b 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
@@ -198,8 +198,10 @@ static int dummy_vnds[0] COMPILER_RT_SECTION(
COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME);
static int dummy_orderfile[0] COMPILER_RT_SECTION(
COMPILER_RT_SEG INSTR_PROF_ORDERFILE_SECT_NAME);
-static int dummy_vname[0] COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VNAME_SECT_NAME);
-static int dummy_vtab[0] COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VTAB_SECT_NAME);
+static int dummy_vname[0] COMPILER_RT_SECTION(
+ COMPILER_RT_SEG INSTR_PROF_VNAME_SECT_NAME);
+static int dummy_vtab[0] COMPILER_RT_SECTION(
+ COMPILER_RT_SEG INSTR_PROF_VTAB_SECT_NAME);
// To avoid GC'ing of the dummy variables by the linker, reference them in an
// array and reference the array in the runtime registration code
@@ -209,10 +211,10 @@ static int dummy_vtab[0] COMPILER_RT_SECTION(COMPILER_RT_SEG INSTR_PROF_VTAB_SEC
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif
COMPILER_RT_VISIBILITY
-void *__llvm_profile_keep[] = {(void *)&dummy_cnts, (void *)&dummy_bits,
- (void *)&dummy_data, (void *)&dummy_name,
- (void *)&dummy_vnds, (void *)&dummy_orderfile,
- (void *)&dummy_vname, (void* )&dummy_vtab};
+void *__llvm_profile_keep[] = {(void *)&dummy_cnts, (void *)&dummy_bits,
+ (void *)&dummy_data, (void *)&dummy_name,
+ (void *)&dummy_vnds, (void *)&dummy_orderfile,
+ (void *)&dummy_vname, (void *)&dummy_vtab};
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index f40cf36a1f..37d7819f77 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -18,12 +18,12 @@
static const __llvm_profile_data *DataFirst = NULL;
static const __llvm_profile_data *DataLast = NULL;
-static const VTableProfData* VTableProfDataFirst = NULL;
-static const VTableProfData* VTableProfDataLast = NULL;
+static const VTableProfData *VTableProfDataFirst = NULL;
+static const VTableProfData *VTableProfDataLast = NULL;
static const char *NamesFirst = NULL;
static const char *NamesLast = NULL;
-static const char* VNamesFirst = NULL;
-sttatic const char* VNamesLast = NULL;
+static const char *VNamesFirst = NULL;
+sttatic const char *VNamesLast = NULL;
static char *CountersFirst = NULL;
static char *CountersLast = NULL;
static uint32_t *OrderFileFirst = NULL;
@@ -84,10 +84,11 @@ COMPILER_RT_VISIBILITY
const __llvm_profile_data *__llvm_profile_begin_data(void) { return DataFirst; }
COMPILER_RT_VISIBILITY
const __llvm_profile_data *__llvm_profile_end_data(void) { return DataLast; }
-COMPILER_RT_VISIBILITY const VTableProfData* __llvm_profile_begin_vtables(void) {
+COMPILER_RT_VISIBILITY const VTableProfData *
+__llvm_profile_begin_vtables(void) {
return VTableProfDataFirst;
}
-COMPILER_RT_VISIBILITY const VTableProfData* __llvm_profile_end_vtables(void) {
+COMPILER_RT_VISIBILITY const VTableProfData *__llvm_profile_end_vtables(void) {
return VTableProfDataLast;
}
COMPILER_RT_VISIBILITY
@@ -95,8 +96,8 @@ const char *__llvm_profile_begin_names(void) { return NamesFirst; }
COMPILER_RT_VISIBILITY
const char *__llvm_profile_end_names(void) { return NamesLast; }
COMPILER_RT_VISIBILITY
-const char* __llvm_profile_begin_vtabnames(void) { return VNamesFirst; }
-const char* __llvm_profile_end_vtabnames(void) { return VNamesLast; }
+const char *__llvm_profile_begin_vtabnames(void) { return VNamesFirst; }
+const char *__llvm_profile_end_vtabnames(void) { return VNamesLast; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_counters(void) { return CountersFirst; }
COMPILER_RT_VISIBILITY
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c b/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
index 2257e95636..09126ee5f9 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
@@ -69,19 +69,19 @@ const __llvm_profile_data *__llvm_profile_begin_data(void) {
}
const __llvm_profile_data *__llvm_profile_end_data(void) { return &DataEnd; }
-const VTableProfData* __llvm_profile_begin_vtables(void) {
+const VTableProfData *__llvm_profile_begin_vtables(void) {
return &VTableProfDataStart + 1;
}
-const VTableProfData* __llvm_profile_end_vtables(void) {
+const VTableProfData *__llvm_profile_end_vtables(void) {
return &VTableProfDataEnd;
}
const char *__llvm_profile_begin_names(void) { return &NamesStart + 1; }
const char *__llvm_profile_end_names(void) { return &NamesEnd; }
-const char* __llvm_profile_begin_vtabnames(void) { return &VNamesStart + 1; }
-const char* __llvm_profile_end_vtabnames(void) { return &VNamesEnd; }
+const char *__llvm_profile_begin_vtabnames(void) { return &VNamesStart + 1; }
+const char *__llvm_profile_end_vtabnames(void) { return &VNamesEnd; }
char *__llvm_profile_begin_counters(void) { return &CountersStart + 1; }
char *__llvm_profile_end_counters(void) { return &CountersEnd; }
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix build failures on non-ELF platforms.
ninja check-profile check-llvm
passed on Darwins.Original description
Raw profile format
Indexed profile format
[InstrFDO][TypeProf] Implement binary instrumentation and profile read/write #66825 will have profile reader/write change and llvm-profdata change.
To ensure this PR has all the necessary profile format change along with profile version bump, created a copy of the originally reviewed patch in #80761. The copy doesn't have profile format change, but it has the set of tests which covers type profile generation, profile read and profile merge. Tests pass there.
rfc in https://discourse.llvm.org/t/rfc-dynamic-type-profiling-and-optimizations-in-llvm/74600