about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/graph.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-01-30 14:25:04 +1100
committerGitHub <noreply@github.com>2025-01-30 14:25:04 +1100
commit6ebe590e4100368afe46b928983f0a2d8a803af2 (patch)
tree81e8995a8c65e7de7ebabd8800c2bcd977d5739f /compiler/rustc_mir_transform/src/coverage/graph.rs
parent4a5f1cc52b7546c61462f1d92b60cc80d40e170f (diff)
parentfb3d1d0c4bcd1b744c8ef23ba977bad9fcd43849 (diff)
downloadrust-6ebe590e4100368afe46b928983f0a2d8a803af2.tar.gz
rust-6ebe590e4100368afe46b928983f0a2d8a803af2.zip
Rollup merge of #135847 - edwloef:slice_ptr_rotate_opt, r=scottmcm
optimize slice::ptr_rotate for small rotates

r? `@scottmcm`

This swaps the positions and numberings of algorithms 1 and 2 in `slice::ptr_rotate`, and pulls the entire outer loop into algorithm 3 since it was redundant for the first two. Effectively, `ptr_rotate` now always does the `memcpy`+`memmove`+`memcpy` sequence if the shifts fit into the stack buffer.
With this change, an `IndexMap`-style `move_index` function is optimized correctly.

Assembly comparisons:
- `move_index`, before: https://godbolt.org/z/Kr616KnYM
- `move_index`, after: https://godbolt.org/z/1aoov6j8h
- the code from `#89714`, before: https://godbolt.org/z/Y4zaPxEG6
- the code from `#89714`, after: https://godbolt.org/z/1dPx83axc

related to #89714
some relevant discussion in https://internals.rust-lang.org/t/idea-shift-move-to-efficiently-move-elements-in-a-vec/22184

Behavior tests pass locally. I can't get any consistent microbenchmark results on my machine, but the assembly diffs look promising.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/graph.rs')
0 files changed, 0 insertions, 0 deletions