summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-08-08 14:32:46 +0000
committerMax Moroz <mmoroz@chromium.org>2018-08-08 14:32:46 +0000
commitc0d857c24c6cf0ad6bad196b287c50c7fd97d8cc (patch)
tree15364bf0004aa86429f43d36c3c17dc483c6c633 /lib/fuzzer/FuzzerLoop.cpp
parent44efdbe4a9a5a9edede07636c8ef0f315e0b2c15 (diff)
downloadcompiler-rt-c0d857c24c6cf0ad6bad196b287c50c7fd97d8cc.tar.gz
[libFuzzer] Optimize handle unstable checks by reducing iterations
Summary: We only run the 3rd check if 2nd check finds unstable edges. 3rd UpdateUnstableCounters is now merged with ApplyUnstableCounters to only run 1 iteration. Patch by Kyungtak Woo (@kevinwkt). Reviewers: Dor1s, metzman, morehouse Reviewed By: Dor1s, morehouse Subscribers: delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D50411 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@339249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r--lib/fuzzer/FuzzerLoop.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/fuzzer/FuzzerLoop.cpp b/lib/fuzzer/FuzzerLoop.cpp
index 23fcb8a40..c7b13d1e5 100644
--- a/lib/fuzzer/FuzzerLoop.cpp
+++ b/lib/fuzzer/FuzzerLoop.cpp
@@ -466,16 +466,11 @@ void Fuzzer::CheckForUnstableCounters(const uint8_t *Data, size_t Size) {
// First Rerun
CBSetupAndRun();
- TPC.UpdateUnstableCounters(Options.HandleUnstable);
-
- // Second Rerun
- CBSetupAndRun();
- TPC.UpdateUnstableCounters(Options.HandleUnstable);
-
- // Move minimum hit counts back to ModuleInline8bitCounters
- if (Options.HandleUnstable == TracePC::MinUnstable ||
- Options.HandleUnstable == TracePC::ZeroUnstable)
- TPC.ApplyUnstableCounters();
+ if (TPC.UpdateUnstableCounters(Options.HandleUnstable)) {
+ // Second Rerun
+ CBSetupAndRun();
+ TPC.UpdateAndApplyUnstableCounters(Options.HandleUnstable);
+ }
}
bool Fuzzer::RunOne(const uint8_t *Data, size_t Size, bool MayDeleteFile,