Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[analysis] Implement an Int lattice - #6037

#6037
Merged
tlively merged 2 commits into
mainWebAssembly/binaryen:mainfrom
int-latticeWebAssembly/binaryen:int-latticeCopy head branch name to clipboard
Oct 25, 2023
Merged

[analysis] Implement an Int lattice#6037
tlively merged 2 commits into
mainWebAssembly/binaryen:mainfrom
int-latticeWebAssembly/binaryen:int-latticeCopy head branch name to clipboard

Conversation

@tlively

@tlively tlively commented Oct 21, 2023

Copy link
Copy Markdown
Member

Implement a generic lattice template for integral types ordered by <.

Comment thread test/gtest/lattices.cpp
ASSERT_EQ(elem, 0);

EXPECT_TRUE(int32.join(elem, 100));
ASSERT_EQ(elem, 100);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How am I supposed to understand this conceptually? That is, why does joining go "up" the integer values rather than down?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the literature, a lattice is a set and a "less than or equal" relation that together satisfy various properties (e.g. reflexivity, transitivity, anti-symmetry, least upper bound, greatest lower bound). Since we call the lattice relation "less than or equal," it is natural to use <= as the default relation for the lattice of integers.

Use cases that require >= instead can use Inverted<UInt32>, introduced in a later PR. If neither ordering is appropriate, it might be a use case for Flat<uint32_t>, also introduced in a later PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks. I think comments that briefly mention this and related things would be useful, to not assume the reader is completely familiar with that literature.

@tlively

tlively commented Oct 25, 2023

Copy link
Copy Markdown
Member Author

Merge activity

  • Oct 25, 1:00 PM: @tlively started a stack merge that includes this pull request via Graphite.
  • Oct 25, 2:19 PM: Graphite rebased this pull request as part of a merge.
  • Oct 25, 2:55 PM: @tlively merged this pull request with Graphite.

Base automatically changed from bool-lattice to main October 25, 2023 18:19
Implement a generic lattice template for integral types ordered by `<`.
@tlively
tlively merged commit a09ea69 into main Oct 25, 2023
@tlively
tlively deleted the int-lattice branch October 25, 2023 18:55
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
Implement a generic lattice template for integral types ordered by `<`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.