From 248d11519ad3f2ff380b8167481cd98e0f9b2175 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 30 Aug 2016 14:39:33 +0000 Subject: [PATCH] [libFuzzer] stop using bits for memcmp's value profile -- seems to blow up the corpus too much llvm-svn: 280096 --- llvm/lib/Fuzzer/FuzzerTraceState.cpp | 12 ++++++------ llvm/lib/Fuzzer/test/value-profile-mem.test | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Fuzzer/FuzzerTraceState.cpp b/llvm/lib/Fuzzer/FuzzerTraceState.cpp index 732e1a44fac0..63dd5a6c649b 100644 --- a/llvm/lib/Fuzzer/FuzzerTraceState.cpp +++ b/llvm/lib/Fuzzer/FuzzerTraceState.cpp @@ -559,9 +559,9 @@ static void AddValueForMemcmp(void *caller_pc, const void *s1, const void *s2, if (A1[I] != A2[I]) break; size_t PC = reinterpret_cast(caller_pc); - size_t Idx = I * 8; - if (I < Len) - Idx += __builtin_popcountl((A1[I] ^ A2[I])) - 1; + size_t Idx = I; + // if (I < Len) + // Idx += __builtin_popcountl((A1[I] ^ A2[I])) - 1; VP.AddValue((PC & 4095) | (Idx << 12)); } @@ -576,9 +576,9 @@ static void AddValueForStrcmp(void *caller_pc, const char *s1, const char *s2, if (A1[I] != A2[I] || A1[I] == 0) break; size_t PC = reinterpret_cast(caller_pc); - size_t Idx = I * 8; - if (I < Len && A1[I]) - Idx += __builtin_popcountl((A1[I] ^ A2[I])) - 1; + size_t Idx = I; + // if (I < Len && A1[I]) + // Idx += __builtin_popcountl((A1[I] ^ A2[I])) - 1; VP.AddValue((PC & 4095) | (Idx << 12)); } diff --git a/llvm/lib/Fuzzer/test/value-profile-mem.test b/llvm/lib/Fuzzer/test/value-profile-mem.test index 059fec85f0e2..60cc67fe72ec 100644 --- a/llvm/lib/Fuzzer/test/value-profile-mem.test +++ b/llvm/lib/Fuzzer/test/value-profile-mem.test @@ -1,4 +1,4 @@ CHECK: BINGO -RUN: not LLVMFuzzer-SingleMemcmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=1000000 2>&1 | FileCheck %s -RUN: not LLVMFuzzer-SingleStrcmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=1000000 2>&1 | FileCheck %s -RUN: not LLVMFuzzer-SingleStrncmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=1000000 2>&1 | FileCheck %s +RUN: not LLVMFuzzer-SingleMemcmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s +RUN: not LLVMFuzzer-SingleStrcmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s +RUN: not LLVMFuzzer-SingleStrncmpTest -seed=1 -use_memcmp=0 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s