diff options
author | Max Moroz <mmoroz@chromium.org> | 2018-07-16 15:15:34 +0000 |
---|---|---|
committer | Max Moroz <mmoroz@chromium.org> | 2018-07-16 15:15:34 +0000 |
commit | 1d369a5d019448be79311906745eea4953fd2ed9 (patch) | |
tree | 68d5b4a3c6295fc0601e7bb019a3ecd78eee19d6 /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | |
parent | 1ff49315aba10764c504aa27050e72bb7a9c40f6 (diff) | |
download | bcm5719-llvm-1d369a5d019448be79311906745eea4953fd2ed9.tar.gz bcm5719-llvm-1d369a5d019448be79311906745eea4953fd2ed9.zip |
Revert r337175 (https://reviews.llvm.org/D49212) due to unintentional format changes.
llvm-svn: 337180
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerTracePC.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp index e12e6c55cf0..4e0ff149df6 100644 --- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp @@ -59,37 +59,6 @@ size_t TracePC::GetTotalPCCoverage() { return Res; } -// Initializes unstable counters by copying Inline8bitCounters to unstable -// counters. -void TracePC::InitializeUnstableCounters() { - if (NumInline8bitCounters && NumInline8bitCounters == NumPCsInPCTables) { - size_t UnstableIdx = 0; - for (size_t i = 0; i < NumModulesWithInline8bitCounters; i++) { - uint8_t *Beg = ModuleCounters[i].Start; - size_t Size = ModuleCounters[i].Stop - Beg; - assert(Size == (size_t)(ModulePCTable[i].Stop - ModulePCTable[i].Start)); - for (size_t j = 0; j < Size; j++, UnstableIdx++) - if (UnstableCounters[UnstableIdx] != kUnstableCounter) - UnstableCounters[UnstableIdx] = Beg[j]; - } - } -} - -// Compares the current counters with counters from previous runs -// and records differences as unstable edges. -void TracePC::UpdateUnstableCounters() { - if (NumInline8bitCounters && NumInline8bitCounters == NumPCsInPCTables) { - size_t UnstableIdx = 0; - for (size_t i = 0; i < NumModulesWithInline8bitCounters; i++) { - uint8_t *Beg = ModuleCounters[i].Start; - size_t Size = ModuleCounters[i].Stop - Beg; - assert(Size == (size_t)(ModulePCTable[i].Stop - ModulePCTable[i].Start)); - for (size_t j = 0; j < Size; j++, UnstableIdx++) - if (Beg[j] != UnstableCounters[UnstableIdx]) - UnstableCounters[UnstableIdx] = kUnstableCounter; - } - } -} void TracePC::HandleInline8bitCountersInit(uint8_t *Start, uint8_t *Stop) { if (Start == Stop) return; @@ -341,15 +310,6 @@ void TracePC::DumpCoverage() { } } -void TracePC::PrintUnstableStats() { - size_t count = 0; - for (size_t i = 0; i < NumInline8bitCounters; i++) - if (UnstableCounters[i] == kUnstableCounter) - count++; - Printf("stat::stability_rate: %.2f\n", - 100 - static_cast<float>(count * 100) / NumInline8bitCounters); -} - // Value profile. // We keep track of various values that affect control flow. // These values are inserted into a bit-set-based hash map. @@ -396,9 +356,9 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) { uint64_t ArgDistance = __builtin_popcountll(ArgXor) + 1; // [1,65] uintptr_t Idx = ((PC & 4095) + 1) * ArgDistance; if (sizeof(T) == 4) - TORC4.Insert(ArgXor, Arg1, Arg2); + TORC4.Insert(ArgXor, Arg1, Arg2); else if (sizeof(T) == 8) - TORC8.Insert(ArgXor, Arg1, Arg2); + TORC8.Insert(ArgXor, Arg1, Arg2); // TODO: remove these flags and instead use all metrics at once. if (UseValueProfileMask & 1) ValueProfileMap.AddValue(Idx); @@ -629,7 +589,7 @@ void __sanitizer_weak_hook_strncmp(void *caller_pc, const char *s1, ATTRIBUTE_INTERFACE ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strcmp(void *caller_pc, const char *s1, - const char *s2, int result) { + const char *s2, int result) { if (fuzzer::ScopedDoingMyOwnMemOrStr::DoingMyOwnMemOrStr) return; if (result == 0) return; // No reason to mutate. size_t N = fuzzer::InternalStrnlen2(s1, s2); |