[libFuzzer] don't clear Counters in TracePC::CollectFeatures since they will be cleared anyway in ResetMaps

llvm-svn: 297783
This commit is contained in:
Kostya Serebryany 2017-03-14 21:40:53 +00:00
parent 8a4bae9993
commit 24d0016bbd
2 changed files with 3 additions and 4 deletions

View File

@ -57,7 +57,7 @@ class TracePC {
void SetUseCounters(bool UC) { UseCounters = UC; } void SetUseCounters(bool UC) { UseCounters = UC; }
void SetUseValueProfile(bool VP) { UseValueProfile = VP; } void SetUseValueProfile(bool VP) { UseValueProfile = VP; }
void SetPrintNewPCs(bool P) { DoPrintNewPCs = P; } 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() { void ResetMaps() {
ValueProfileMap.Reset(); ValueProfileMap.Reset();
@ -111,7 +111,7 @@ private:
}; };
template <class Callback> template <class Callback>
size_t TracePC::CollectFeatures(Callback CB) { size_t TracePC::CollectFeatures(Callback CB) const {
if (!UsingTracePcGuard()) return 0; if (!UsingTracePcGuard()) return 0;
size_t Res = 0; size_t Res = 0;
const size_t Step = 8; const size_t Step = 8;
@ -125,7 +125,6 @@ size_t TracePC::CollectFeatures(Callback CB) {
for (size_t i = Idx; i < Idx + Step; i++) { for (size_t i = Idx; i < Idx + Step; i++) {
uint8_t Counter = (Bundle >> ((i - Idx) * 8)) & 0xff; uint8_t Counter = (Bundle >> ((i - Idx) * 8)) & 0xff;
if (!Counter) continue; if (!Counter) continue;
Counters[i] = 0;
unsigned Bit = 0; unsigned Bit = 0;
/**/ if (Counter >= 128) Bit = 7; /**/ if (Counter >= 128) Bit = 7;
else if (Counter >= 32) Bit = 6; else if (Counter >= 32) Bit = 6;

View File

@ -76,7 +76,7 @@ struct ValueBitMap {
template <class Callback> template <class Callback>
ATTRIBUTE_NO_SANITIZE_ALL ATTRIBUTE_NO_SANITIZE_ALL
void ForEach(Callback CB) { void ForEach(Callback CB) const {
for (size_t i = 0; i < kMapSizeInWords; i++) for (size_t i = 0; i < kMapSizeInWords; i++)
if (uintptr_t M = Map[i]) if (uintptr_t M = Map[i])
for (size_t j = 0; j < sizeof(M) * 8; j++) for (size_t j = 0; j < sizeof(M) * 8; j++)