Skip to content

Commit ac719d7

Browse files
committed
[InstrProf] Don't profile merge by default in lightweight mode
Profile merging is not supported when using debug info profile correlation because the data section won't be in the binary at runtime. Change the default profile name in this mode to `default_%p.proflite` so we don't use profile merging. Reviewed By: kyulee Differential Revision: https://reviews.llvm.org/D115979
1 parent 19727e3 commit ac719d7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace {
102102

103103
// Default filename used for profile generation.
104104
std::string getDefaultProfileGenName() {
105-
return DebugInfoCorrelate ? "default_%m.proflite" : "default_%m.profraw";
105+
return DebugInfoCorrelate ? "default_%p.proflite" : "default_%m.profraw";
106106
}
107107

108108
class EmitAssemblyHelper {

compiler-rt/lib/profile/InstrProfilingMerge.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ static uintptr_t signextIfWin64(void *V) {
9595
COMPILER_RT_VISIBILITY
9696
int __llvm_profile_merge_from_buffer(const char *ProfileData,
9797
uint64_t ProfileSize) {
98-
if (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE)
98+
if (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE) {
99+
PROF_ERR(
100+
"%s\n",
101+
"Debug info correlation does not support profile merging at runtime. "
102+
"Instead, merge raw profiles using the llvm-profdata tool.");
99103
return 1;
104+
}
100105

101106
__llvm_profile_data *SrcDataStart, *SrcDataEnd, *SrcData, *DstData;
102107
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;

0 commit comments

Comments
 (0)