diff options
author | Thomas Lively <tlively@google.com> | 2023-10-27 22:48:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 13:48:49 -0700 |
commit | 57e0b2f8ed64d35d9ee2ca350d74ed66ed941c54 (patch) | |
tree | b2ec2b85350ed6646eba10a8d2441c8eaaef1f61 /src/analysis/lattices | |
parent | 0aa46e4ee194dd63d9348a16a0b219e548839303 (diff) | |
download | binaryen-57e0b2f8ed64d35d9ee2ca350d74ed66ed941c54.tar.gz binaryen-57e0b2f8ed64d35d9ee2ca350d74ed66ed941c54.tar.bz2 binaryen-57e0b2f8ed64d35d9ee2ca350d74ed66ed941c54.zip |
[analysis] Improve lattice fuzzer (#6050)
Implement new `RandomLattice` and `RandomFullLattice` utilities that are
lattices randomly created from other lattices. By recursively using themselves
as the parameter lattices for lattices like `Inverted` and `Lift`, these random
lattices can become arbitrarily nested.
Decouple the checking of lattice properties from the checking of transfer
function properties by creating a new, standalone `checkLatticeProperties`
function.
Diffstat (limited to 'src/analysis/lattices')
-rw-r--r-- | src/analysis/lattices/inverted.h | 2 | ||||
-rw-r--r-- | src/analysis/lattices/lift.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/analysis/lattices/inverted.h b/src/analysis/lattices/inverted.h index 92b965323..c69f71a8b 100644 --- a/src/analysis/lattices/inverted.h +++ b/src/analysis/lattices/inverted.h @@ -35,7 +35,7 @@ template<FullLattice L> struct Inverted { Element getBottom() const noexcept { return lattice.getTop(); } Element getTop() const noexcept { return lattice.getBottom(); } LatticeComparison compare(const Element& a, const Element& b) const noexcept { - return reverseComparison(lattice.compare(a, b)); + return lattice.compare(b, a); } bool join(Element& self, Element other) const noexcept { return lattice.meet(self, other); diff --git a/src/analysis/lattices/lift.h b/src/analysis/lattices/lift.h index a458fd6b6..fc7c9754f 100644 --- a/src/analysis/lattices/lift.h +++ b/src/analysis/lattices/lift.h @@ -40,6 +40,7 @@ template<Lattice L> struct Lift { }; L lattice; + Lift(L&& lattice) : lattice(std::move(lattice)) {} Element getBottom() const noexcept { return {std::nullopt}; } |