Repository navigation
codegen: aggregate-copy memmove only across a write-free load/store pair (#1689) - #1693
Merged
Merged
Conversation
…tween the load and the store can write memory (#1689) wl_lower_aggregate_copies rewrote `store (load %T, src), dst` into a memmove positioned at the store, so the source was read after everything between the load and the store had run. Vec.remove loads the element, calls with_vec_remove to shift the buffer, then stores the result: for an element of 64 bytes or more the memmove copied the shifted slot, so `remove(0)` returned the wrong element and consuming iteration yielded the last element at every position. The rewrite now requires the load and the store to share a block with no store, call, fence or atomic between them — the adjacent bulk-move shape the pass exists for (#1129).
Contributor
Author
|
Battery verdict — green. Pinned seed |
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.
Fixes #1689.
wl_lower_aggregate_copiesplaced the memmove at the store, reading the source after intervening writes;Vec.remove(load element, shift buffer, store result) returned the shifted slot for elements >= 64 bytes, andinto_iterinherited it. The rewrite now requires an adjacent write-free load/store pair in one block. Fixture:test/behavior/behav_vec_remove_large_element.w(POD, three-str record, into_iter). Codegen change: alone in its battery, draft until green.