[PATCH] D73776: Entropic: Boosting LibFuzzer Performance

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 14:15:27 PST 2020


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/FuzzerCorpus.h:41
   Vector<uint8_t> DataFlowTraceForFocusFunction;
+  // Power schedule.
+  bool NeedsUpdate;
----------------
it would be nice to manipulate this fields only with reasonable named methods


================
Comment at: compiler-rt/lib/fuzzer/FuzzerCorpus.h:43
+  bool NeedsUpdate;
+  double Energy;
+  size_t Sum_Y;
----------------
could you please initialize them?


================
Comment at: compiler-rt/lib/fuzzer/FuzzerCorpus.h:387
+    size_t Y = 0;
+    size_t Sum_Y = 0;
+    long double Energy = 0.0L;
----------------
It would be nice to rename variables in a such way that reader without background can understand what is going on.


================
Comment at: compiler-rt/lib/fuzzer/FuzzerCorpus.h:395
+    for (auto F : II->FeatureFreqs) {
+      Y = F.second + 1;
+      Energy -= Y * logl(Y);
----------------
please don't reuse variables like Y here
just declare as close as possible to first use, or even better with assignment


================
Comment at: compiler-rt/lib/fuzzer/FuzzerCorpus.h:530
+  uint16_t FreqOfMostAbundantRareFeature = 0;
+  uint16_t GlobalFeatureFreqs[kFeatureSetSize];
+  Vector<uint32_t> RareFeatures;
----------------
uint16_t GlobalFeatureFreqs[kFeatureSetSize] = {}; instead of memsets
it would be nice do to the same for other arrays here, but in a separate patch


================
Comment at: compiler-rt/lib/fuzzer/FuzzerFlags.def:156
      "will choose the focus functions automatically.")
+FUZZER_FLAG_INT(entropic, 0, "Experimental. Enables entropic power schedule.")
+FUZZER_FLAG_INT(considered_rare, 0xFF, "Experimental. If entropic is enabled, "
----------------
entropic -> focus_rare_features


Not sure how, it would be nice to rename sparse_energy_updates as something meaningful to libfuzzer user, to make it explain behavior change, not implementation details like now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73776/new/

https://reviews.llvm.org/D73776





More information about the llvm-commits mailing list