[PATCH] D50411: [libFuzzer] Optimize handle unstable checks by reducing iterations

Kyungtak Woo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 15:39:24 PDT 2018


kevinwkt marked an inline comment as done.
kevinwkt added a comment.

In https://reviews.llvm.org/D50411#1191591, @Dor1s wrote:

> Nice! Do you have an estimate on the performance improvement? The code becomes slightly harder to read, but I guess it's worth it.


Obviously this would depend on how big and unstable the target is.
Currently, for every new edge we find we run 3x even if it is deterministic.

We would be getting rid of the extra 3rd run for every new deterministic run we find.
Also, since we merged Update and Apply UnstableCounters, we get rid of an iteration for every input that goes through HandleUnstableChecks.



================
Comment at: lib/fuzzer/FuzzerLoop.cpp:469
   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
----------------
Dor1s wrote:
> Just to verify: if we haven't detected any instability, we don't need to apply the counters, right?
Yeah, if we don't detect instability, Inline8bitCounters would be equal to UnstableCounters.


https://reviews.llvm.org/D50411





More information about the llvm-commits mailing list