summaryrefslogtreecommitdiff
path: root/gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c')
-rw-r--r--gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c b/gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c
index 6df65f66df7..fdb7b7cd806 100644
--- a/gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c
+++ b/gnu/llvm/compiler-rt/lib/profile/InstrProfiling.c
@@ -25,7 +25,7 @@ COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_magic(void) {
: (INSTR_PROF_RAW_MAGIC_32);
}
-COMPILER_RT_VISIBILITY void __llvm_profile_set_dumped() {
+COMPILER_RT_VISIBILITY void __llvm_profile_set_dumped(void) {
lprofSetProfileDumped(1);
}
@@ -38,14 +38,16 @@ __llvm_profile_get_num_padding_bytes(uint64_t SizeInBytes) {
}
COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_version(void) {
- return __llvm_profile_raw_version;
+ return INSTR_PROF_RAW_VERSION_VAR;
}
COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
- uint64_t *I = __llvm_profile_begin_counters();
- uint64_t *E = __llvm_profile_end_counters();
+ char *I = __llvm_profile_begin_counters();
+ char *E = __llvm_profile_end_counters();
- memset(I, 0, sizeof(uint64_t) * (E - I));
+ char ResetValue =
+ (__llvm_profile_get_version() & VARIANT_MASK_BYTE_COVERAGE) ? 0xFF : 0;
+ memset(I, ResetValue, E - I);
const __llvm_profile_data *DataBegin = __llvm_profile_begin_data();
const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
@@ -62,11 +64,11 @@ COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
CurrentVSiteCount += DI->NumValueSites[VKI];
for (i = 0; i < CurrentVSiteCount; ++i) {
- ValueProfNode *CurrentVNode = ValueCounters[i];
+ ValueProfNode *CurrVNode = ValueCounters[i];
- while (CurrentVNode) {
- CurrentVNode->Count = 0;
- CurrentVNode = CurrentVNode->Next;
+ while (CurrVNode) {
+ CurrVNode->Count = 0;
+ CurrVNode = CurrVNode->Next;
}
}
}