[compiler-rt] r320259 - [libFuzzer] even less aggressive step function for stack depth. Also don't use asan in one test to speed it up

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 9 11:18:10 PST 2017


Author: kcc
Date: Sat Dec  9 11:18:10 2017
New Revision: 320259

URL: http://llvm.org/viewvc/llvm-project?rev=320259&view=rev
Log:
[libFuzzer] even less aggressive step function for stack depth. Also don't use asan in one test to speed it up

Modified:
    compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.h
    compiler-rt/trunk/test/fuzzer/value-profile-cmp2.test

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.h?rev=320259&r1=320258&r2=320259&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.h Sat Dec  9 11:18:10 2017
@@ -274,8 +274,19 @@ void TracePC::CollectFeatures(Callback H
     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;

Modified: compiler-rt/trunk/test/fuzzer/value-profile-cmp2.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/value-profile-cmp2.test?rev=320259&r1=320258&r2=320259&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/value-profile-cmp2.test (original)
+++ compiler-rt/trunk/test/fuzzer/value-profile-cmp2.test Sat Dec  9 11:18:10 2017
@@ -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




More information about the llvm-commits mailing list