[llvm] r279588 - [libFuzzer] collect 64 states for value profile, not 65
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 16:37:37 PDT 2016
Author: kcc
Date: Tue Aug 23 18:37:37 2016
New Revision: 279588
URL: http://llvm.org/viewvc/llvm-project?rev=279588&view=rev
Log:
[libFuzzer] collect 64 states for value profile, not 65
Modified:
llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp?rev=279588&r1=279587&r2=279588&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTraceState.cpp Tue Aug 23 18:37:37 2016
@@ -576,8 +576,12 @@ static void AddValueForStrcmp(void *call
__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
More information about the llvm-commits
mailing list