Add shrink pass for pairs of bytes #2483
Closed
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.
A thing I've been noticing in recent work is that we don't do very well at lexicographic shrinks that are obvious if we ignore the block structure but cross block boundaries. In particular there's a common pattern where we have a pair of adjacent bytes that would be trivial to shrink but we never try.
In particular the reason #2482 is currently failing is because of a failure to apply such a reduction.
This PR adds a shrink pass that applies lexicographic shrinks to pairs of bytes, which will get us unstuck in those cases. We're mainly interested in adjacent pairs of bytes, but it turns out that there are a number of special cases to worry about here where the shrinker will just take forever and a day to complete if you only focus on adjacent pairs of bytes, so we have some additional logic to skip over sequences of zeroes.