diff options
author | Kostya Serebryany <kcc@google.com> | 2017-12-09 19:18:10 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2017-12-09 19:18:10 +0000 |
commit | ad3dbbda589b45eb4a70561209b46694e35ea46c (patch) | |
tree | 5e9661b30228f17609b2c2c900a0f7b4d973be28 | |
parent | 9595ecdaa969da106b922e08dc9d21a92ee1a438 (diff) |
[libFuzzer] even less aggressive step function for stack depth. Also don't use asan in one test to speed it up
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320259 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/fuzzer/FuzzerTracePC.h | 13 | ||||
-rw-r--r-- | test/fuzzer/value-profile-cmp2.test | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/fuzzer/FuzzerTracePC.h b/lib/fuzzer/FuzzerTracePC.h index bc7e5ec03..300e5db38 100644 --- a/lib/fuzzer/FuzzerTracePC.h +++ b/lib/fuzzer/FuzzerTracePC.h @@ -274,8 +274,19 @@ void TracePC::CollectFeatures(Callback HandleFeature) const { FirstFeature += ValueProfileMap.SizeInBits(); } + // Step function, grows similar to 8 * Log_2(A). + auto StackDepthStepFunction = [](uint32_t A) -> uint32_t { + uint32_t Log2 = 32 - __builtin_clz(A) - 1; + if (Log2 < 3) return A; + Log2 -= 3; + return (Log2 + 1) * 8 + ((A >> Log2) & 7); + }; + assert(StackDepthStepFunction(1024) == 64); + assert(StackDepthStepFunction(1024 * 4) == 80); + assert(StackDepthStepFunction(1024 * 1024) == 144); + if (auto MaxStackOffset = GetMaxStackOffset()) - HandleFeature(FirstFeature + MaxStackOffset / 128); + HandleFeature(FirstFeature + StackDepthStepFunction(MaxStackOffset / 8)); } extern TracePC TPC; diff --git a/test/fuzzer/value-profile-cmp2.test b/test/fuzzer/value-profile-cmp2.test index 43dd8f9dd..a585c9317 100644 --- a/test/fuzzer/value-profile-cmp2.test +++ b/test/fuzzer/value-profile-cmp2.test @@ -1,3 +1,3 @@ CHECK: BINGO -RUN: %cpp_compiler %S/SimpleHashTest.cpp -o %t-SimpleHashTest +RUN: %cpp_compiler -fno-sanitize=address %S/SimpleHashTest.cpp -o %t-SimpleHashTest RUN: not %t-SimpleHashTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 -max_len=64 2>&1 | FileCheck %s |