[libFuzzer] new experimental feature: value profiling. Profiles values that affect control flow and treats new values as new coverage.
llvm-svn: 278839
diff --git a/llvm/lib/Fuzzer/FuzzerValueBitMap.h b/llvm/lib/Fuzzer/FuzzerValueBitMap.h
index 41169d6..493afc5 100644
--- a/llvm/lib/Fuzzer/FuzzerValueBitMap.h
+++ b/llvm/lib/Fuzzer/FuzzerValueBitMap.h
@@ -32,7 +32,7 @@
Map[WordIdx] |= 1UL << BitIdx;
}
- // Merges 'Other' into 'this', clear Other,
+ // Merges 'Other' into 'this', clears 'Other',
// returns the number of set bits in 'this'.
size_t MergeFrom(ValueBitMap &Other) {
uintptr_t Res = 0;
@@ -43,7 +43,8 @@
Map[i] = (M |= O);
Other.Map[i] = 0;
}
- Res += __builtin_popcountl(M);
+ if (M)
+ Res += __builtin_popcountl(M);
}
return Res;
}