[PATCH] D65905: [compiler-rt] Add ConsumeProbability and ConsumeFloatingPoint methods to FDP.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 16:14:42 PDT 2019


morehouse accepted this revision.
morehouse added inline comments.
This revision is now accepted and ready to land.


================
Comment at: include/fuzzer/FuzzedDataProvider.hpp:224
+    constexpr T zero(.0);
+    if ((min >= zero && max >= zero) || (min <= zero && max <= zero)) {
+      // Use range-based implementation, as |min| and |max| have the same
----------------
Nit:  `min <= max`, so this is equivalent to `min >= 0 || max <= 0`.


================
Comment at: include/fuzzer/FuzzedDataProvider.hpp:234
+    T positive = max * ConsumeProbability<T>();
+    return min + max;
+  }
----------------
This seems like it might favor the middle part of the range over others.  Probably not a big issue for fuzzing, but might be worth thinking about.


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D65905





More information about the llvm-commits mailing list