[llvm] r297783 - [libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 14:40:53 PDT 2017
Author: kcc
Date: Tue Mar 14 16:40:53 2017
New Revision: 297783
URL: http://llvm.org/viewvc/llvm-project?rev=297783&view=rev
Log:
[libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps
Modified:
llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.h?rev=297783&r1=297782&r2=297783&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.h Tue Mar 14 16:40:53 2017
@@ -57,7 +57,7 @@ class TracePC {
void SetUseCounters(bool UC) { UseCounters = UC; }
void SetUseValueProfile(bool VP) { UseValueProfile = VP; }
void SetPrintNewPCs(bool P) { DoPrintNewPCs = P; }
- template <class Callback> size_t CollectFeatures(Callback CB);
+ template <class Callback> size_t CollectFeatures(Callback CB) const;
void ResetMaps() {
ValueProfileMap.Reset();
@@ -111,7 +111,7 @@ private:
};
template <class Callback>
-size_t TracePC::CollectFeatures(Callback CB) {
+size_t TracePC::CollectFeatures(Callback CB) const {
if (!UsingTracePcGuard()) return 0;
size_t Res = 0;
const size_t Step = 8;
@@ -125,7 +125,6 @@ size_t TracePC::CollectFeatures(Callback
for (size_t i = Idx; i < Idx + Step; i++) {
uint8_t Counter = (Bundle >> ((i - Idx) * 8)) & 0xff;
if (!Counter) continue;
- Counters[i] = 0;
unsigned Bit = 0;
/**/ if (Counter >= 128) Bit = 7;
else if (Counter >= 32) Bit = 6;
Modified: llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h?rev=297783&r1=297782&r2=297783&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h Tue Mar 14 16:40:53 2017
@@ -76,7 +76,7 @@ struct ValueBitMap {
template <class Callback>
ATTRIBUTE_NO_SANITIZE_ALL
- void ForEach(Callback CB) {
+ void ForEach(Callback CB) const {
for (size_t i = 0; i < kMapSizeInWords; i++)
if (uintptr_t M = Map[i])
for (size_t j = 0; j < sizeof(M) * 8; j++)
More information about the llvm-commits
mailing list