diff options
author | Bruce He <44327446+zm2he@users.noreply.github.com> | 2023-07-26 21:09:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 17:09:22 -0400 |
commit | c015c9fee1e0af4d3a1da2ff435b020ff107abd8 (patch) | |
tree | bda1cd50ad9fc447866ba407fc6b434bc9280ce8 /src/analysis | |
parent | f2a8b86725c0d1ee3890dc80f8d3b4c094db38ac (diff) | |
download | binaryen-c015c9fee1e0af4d3a1da2ff435b020ff107abd8.tar.gz binaryen-c015c9fee1e0af4d3a1da2ff435b020ff107abd8.tar.bz2 binaryen-c015c9fee1e0af4d3a1da2ff435b020ff107abd8.zip |
Add a Fuzzer for Lattice and Transfer Function Properties (#5831)
This change adds a fuzzer which checks the following properties in
abstract interpretation static analyses.
- Transfer Function Monotonicity
- Lattice Element Reflexivity
- Lattice Element Transitivity
- Lattice Element Anti-Symmetry
This is done by randomly generating a module and using its functions as
transfer function inputs, along with randomly generated lattice elements
(states). Lattice element properties are fuzzed from the randomly
generated states also.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/lattice.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/analysis/lattice.h b/src/analysis/lattice.h index 5ab92a320..a5c7047dd 100644 --- a/src/analysis/lattice.h +++ b/src/analysis/lattice.h @@ -11,6 +11,18 @@ namespace wasm::analysis { enum LatticeComparison { NO_RELATION, EQUAL, LESS, GREATER }; +// If parameter "comparison" compares x and y, the function returns the opposite +// direction comparison between y and x. +inline LatticeComparison reverseComparison(LatticeComparison comparison) { + if (comparison == LatticeComparison::LESS) { + return LatticeComparison::GREATER; + } else if (comparison == LatticeComparison::GREATER) { + return LatticeComparison::LESS; + } else { + return comparison; + } +} + template<typename Lattice> constexpr bool has_getBottom = std::is_invocable_r<typename Lattice::Element, |