Let codegen decide when to `mem::swap` with immediates by scottmcm · Pull Reques...
source link: https://github.com/rust-lang/rust/pull/122582
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Let codegen decide when to mem::swap
with immediates
#122582
Conversation
Member
Making libcore
decide this is silly; the backend has so much better information about when it's a good idea.
Thus this PR introduces a new typed_swap
intrinsic with a fallback body, and replaces that fallback implementation when swapping immediates or scalar pairs.
r? oli-obk
Replaces #111744, and means we'll never need more libs PRs like #111803 or #107140
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Collaborator
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri The Miri subtree was changed cc @rust-lang/miri |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Member
Author
This comment has been minimized.
Contributor
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment was marked as outdated.
added perf-regression Performance regressions
and removed S-waiting-on-perf Status: Waiting on a perf run to be completed.
labels
Outdated
@@ -954,6 +954,23 @@ pub const unsafe fn swap<T>(x: *mut T, y: *mut T) { | ||
} |
||
} |
||
/// Non-overlapping *typed* swap of a single value. |
Should it be called typed_swap_nonoverlapping
?
Member
Author
I went back and forth multiple times on this. typed_swap_nonoverlapping
sounds to me like ptr::swap_nonoverlapping
, just typed. So that would make this typed_swap_nonoverlapping_one
or something, and now that's just seeming really long.
So since it's internal, I think I'm inclined to leave it as-is for now unless someone feels particularly strongly about it.
I feel like the "nonoverlapping" distinction is way more fundamental than the "one" distinction. And since it is internal, consistency with ptr::swap_nonoverlapping
isn't very important IMO.
This comment has been minimized.
Contributor
💔 Test failed - checks-actions |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Member
Author
@bors r=oli-obk |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
⌛ Testing commit 75d2e5b with merge ea4d0e9044c417ec9df5b45620f316879fd179c2... |
Contributor
💥 Test timed out |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Member
@bors retry |
added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
labels
Contributor
☀️ Test successful - checks-actions |
Collaborator
Finished benchmarking commit (d6eb0f5): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results CyclesResults Binary sizeResults Bootstrap: 669.588s -> 671.198s (0.24%) |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK