diff options
author | Kostya Serebryany <kcc@google.com> | 2018-07-03 22:33:09 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2018-07-03 22:33:09 +0000 |
commit | 3080d045631a8f6145db1cd757b5cf210585a2b3 (patch) | |
tree | b3b352b44b81ca054fee2b49ea48bf0511c84202 /lib/fuzzer/FuzzerTracePC.cpp | |
parent | 9aa2b629129147049ad614648ce7a2f7030e44a2 (diff) |
[libFuzzer] add one more value profile metric, under a flag (experimental)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerTracePC.cpp')
-rw-r--r-- | lib/fuzzer/FuzzerTracePC.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/fuzzer/FuzzerTracePC.cpp b/lib/fuzzer/FuzzerTracePC.cpp index 540d88882..19c1eaf14 100644 --- a/lib/fuzzer/FuzzerTracePC.cpp +++ b/lib/fuzzer/FuzzerTracePC.cpp @@ -356,7 +356,14 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) { TORC4.Insert(ArgXor, Arg1, Arg2); else if (sizeof(T) == 8) TORC8.Insert(ArgXor, Arg1, Arg2); - ValueProfileMap.AddValue(Idx); + // TODO: remove these flags and instead use all metrics at once. + if (UseValueProfileMask & 1) + ValueProfileMap.AddValue(Idx); + if (UseValueProfileMask & 2) + ValueProfileMap.AddValue( + PC * 64 + (Arg1 == Arg2 ? 0 : __builtin_clzll(Arg1 - Arg2) + 1)); + if (UseValueProfileMask & 4) // alternative way to use the hamming distance + ValueProfileMap.AddValue(PC * 64 + ArgDistance); } static size_t InternalStrnlen(const char *S, size_t MaxLen) { |