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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany 2016-08-23 23:37:37 +00:00
parent 94041883a5
commit bb66a7d956

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