1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[libFuzzer] collect 64 states for value profile, not 65

llvm-svn: 279588
This commit is contained in:
Kostya Serebryany 2016-08-23 23:37:37 +00:00
parent 711f079c2c
commit b0ba8a2254

View File

@ -576,8 +576,12 @@ static void AddValueForStrcmp(void *caller_pc, const char *s1, const char *s2,
__attribute__((target("popcnt")))
static void AddValueForCmp(void *PCptr, uint64_t Arg1, uint64_t Arg2) {
if (Arg1 == Arg2)
return;
uintptr_t PC = reinterpret_cast<uintptr_t>(PCptr);
VP.AddValue((PC & 4095) | (__builtin_popcountl(Arg1 ^ Arg2) << 12));
uint64_t ArgDistance = __builtin_popcountl(Arg1 ^ Arg2) - 1; // [0,63]
uintptr_t Idx = (PC & 4095) | (ArgDistance << 12);
VP.AddValue(Idx);
}
} // namespace fuzzer