@@ -47,6 +47,7 @@ uint64_t lprofGetLoadModuleSignature(void) {
47
47
COMPILER_RT_VISIBILITY
48
48
int __llvm_profile_check_compatibility (const char * ProfileData ,
49
49
uint64_t ProfileSize ) {
50
+ /* Check profile header only for now */
50
51
__llvm_profile_header * Header = (__llvm_profile_header * )ProfileData ;
51
52
__llvm_profile_data * SrcDataStart , * SrcDataEnd , * SrcData , * DstData ;
52
53
SrcDataStart =
@@ -101,6 +102,13 @@ static uintptr_t signextIfWin64(void *V) {
101
102
COMPILER_RT_VISIBILITY
102
103
int __llvm_profile_merge_from_buffer (const char * ProfileData ,
103
104
uint64_t ProfileSize ) {
105
+ if (__llvm_profile_get_version () & VARIANT_MASK_DBG_CORRELATE ) {
106
+ PROF_ERR (
107
+ "%s\n" ,
108
+ "Debug info correlation does not support profile merging at runtime. "
109
+ "Instead, merge raw profiles using the llvm-profdata tool." );
110
+ return 1 ;
111
+ }
104
112
if (__llvm_profile_get_version () & VARIANT_MASK_TEMPORAL_PROF ) {
105
113
PROF_ERR ("%s\n" ,
106
114
"Temporal profiles do not support profile merging at runtime. "
@@ -110,8 +118,7 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
110
118
111
119
__llvm_profile_data * SrcDataStart , * SrcDataEnd , * SrcData , * DstData ;
112
120
__llvm_profile_header * Header = (__llvm_profile_header * )ProfileData ;
113
- char * SrcCountersStart , * DstCounter ;
114
- const char * SrcCountersEnd , * SrcCounter ;
121
+ char * SrcCountersStart ;
115
122
const char * SrcNameStart ;
116
123
const char * SrcValueProfDataStart , * SrcValueProfData ;
117
124
uintptr_t CountersDelta = Header -> CountersDelta ;
@@ -121,36 +128,14 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
121
128
Header -> BinaryIdsSize );
122
129
SrcDataEnd = SrcDataStart + Header -> NumData ;
123
130
SrcCountersStart = (char * )SrcDataEnd ;
124
- SrcCountersEnd = SrcCountersStart +
125
- Header -> NumCounters * __llvm_profile_counter_entry_size ();
126
- SrcNameStart = SrcCountersEnd ;
131
+ SrcNameStart = SrcCountersStart +
132
+ Header -> NumCounters * __llvm_profile_counter_entry_size ();
127
133
SrcValueProfDataStart =
128
134
SrcNameStart + Header -> NamesSize +
129
135
__llvm_profile_get_num_padding_bytes (Header -> NamesSize );
130
136
if (SrcNameStart < SrcCountersStart )
131
137
return 1 ;
132
138
133
- // Merge counters when there is no data section and debug info correlation is
134
- // enabled.
135
- if (Header -> NumData == 0 ) {
136
- if (!(__llvm_profile_get_version () & VARIANT_MASK_DBG_CORRELATE )) {
137
- PROF_ERR ("%s\n" , "Missing profile data section." );
138
- return 1 ;
139
- }
140
- for (SrcCounter = SrcCountersStart ,
141
- DstCounter = __llvm_profile_begin_counters ();
142
- SrcCounter < SrcCountersEnd ;) {
143
- if (__llvm_profile_get_version () & VARIANT_MASK_BYTE_COVERAGE ) {
144
- * DstCounter &= * SrcCounter ;
145
- } else {
146
- * (uint64_t * )DstCounter += * (uint64_t * )SrcCounter ;
147
- }
148
- SrcCounter += __llvm_profile_counter_entry_size ();
149
- DstCounter += __llvm_profile_counter_entry_size ();
150
- }
151
- return 0 ;
152
- }
153
-
154
139
for (SrcData = SrcDataStart ,
155
140
DstData = (__llvm_profile_data * )__llvm_profile_begin_data (),
156
141
SrcValueProfData = SrcValueProfDataStart ;
0 commit comments