[PATCH] D49621: [libFuzzer] Initial implementation of weighted mutation leveraging during runtime.

Kodé Williams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 11:20:52 PDT 2018


kodewilliams marked 2 inline comments as done.
kodewilliams added inline comments.


================
Comment at: lib/fuzzer/FuzzerMutate.cpp:606
+    Weights[i] = Stats[i] / SumOfStats;
+  Distribution = std::discrete_distribution<size_t>(Weights.begin(), Weights.end());
+}
----------------
Dor1s wrote:
> morehouse wrote:
> > I think you can do `Distribution.param(Weights)` rather than reconstructing.  Might be faster.
> Oh, right. Thanks for spotting, Matt! Kode, please remove lines 603-605 and try passing `Stats` to the distribution.
One param function doesnt take arguments (returns a param_type object) and the other one sets the new params based on a passed in param_type object, but there would have to be another discrete_distribution object from which the param_type object would be obtained so I think that's why they do it this way in https://cs.corp.google.com/piper///depot/google3/third_party/llvm/llvm/projects/compiler-rt/lib/fuzzer/FuzzerCorpus.h?rcl=206864844&l=294

Quite literally I would have to do Distribution.param(Distribution.param()) but I'm not sure that would update the distribution.


================
Comment at: lib/fuzzer/FuzzerMutate.cpp:602
+  if (!SumOfStats) return;
+  Distribution = std::discrete_distribution<size_t>(Stats.begin(), Stats.end());
+}
----------------
morehouse wrote:
> Does `Distribution.param(Stats)` work instead?
Please see other comment on Distribution.param(Weights).



Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49621





More information about the llvm-commits mailing list