Conversation
kripken
commented
Sep 25, 2026
| if (constraints.provesNothing()) { | ||
| setProvesNothing(index); | ||
| } else { | ||
| if (!constraints.provesNothing()) { |
Member
Author
There was a problem hiding this comment.
Drive-by fix, see the comment on line 1054 - we already prove nothing at this point.
kripken
commented
Sep 25, 2026
| // We just proved we are in unreachable code. | ||
| unreachable = true; | ||
| map.clear(); | ||
| refs.clear(); |
Member
Author
There was a problem hiding this comment.
Another drive-by trivial fix (irrelevent for correctness, see the comment on new line 1215).
kripken
commented
Sep 25, 2026
|
|
||
| auto& refIndexes = iter->second; | ||
| auto refIndexes = std::move(iter->value); | ||
| refs.erase(iter); |
Member
Author
There was a problem hiding this comment.
(as above, we kept around stale refs unnecessarily; added a comment in the header to mention that this function is called when we wipe out all the info)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We usually have only a few useful constraints, so the map is mostly
empty. An
unordered_mapis then pretty inefficient, and it is betterto use a vector. Sorting it makes lookup still pretty fast.
This especially helps in ORing two sets of constraints, as we can
just do an intersection (the OR result is only interesting if we had
something in both inputs - otherwise we can prove nothing), which
is efficient on sorted vectors.
To implement this, generalize the existing SortedVector.
This makes the pass 50% faster on average, though the spread
is wide (20%-almost 2X faster). I tested around 10 real-world
wasm files and did not see a single one with less than an 18%
speedup, and never a regression.