diff options
author | Kostya Serebryany <kcc@google.com> | 2016-08-23 23:37:37 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-08-23 23:37:37 +0000 |
commit | ac524cfcce82544e91f5ca2d0c5b717a56fd66b4 (patch) | |
tree | 7540548a961f39b5f99f537953361e1383ccc7f3 /llvm/lib/Fuzzer/FuzzerTraceState.cpp | |
parent | b5dad1ee99c9a41db55040e7804a83374b1435dc (diff) | |
download | bcm5719-llvm-ac524cfcce82544e91f5ca2d0c5b717a56fd66b4.tar.gz bcm5719-llvm-ac524cfcce82544e91f5ca2d0c5b717a56fd66b4.zip |
[libFuzzer] collect 64 states for value profile, not 65
llvm-svn: 279588
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerTraceState.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerTraceState.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerTraceState.cpp b/llvm/lib/Fuzzer/FuzzerTraceState.cpp index 71ff499d4d3..4192ceb7e92 100644 --- a/llvm/lib/Fuzzer/FuzzerTraceState.cpp +++ b/llvm/lib/Fuzzer/FuzzerTraceState.cpp @@ -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 |