Uh oh!
There was an error while loading. Please reload this page.
Make copy/copy_nonoverlapping fn's again - #86003
Conversation
This is preparation for reverting 81238 for short-term resolution of issue 84297.
rust-highfive
commented
Jun 4, 2021
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
rust-highfive
commented
Jun 4, 2021
r? @yaahc (rust-highfive has picked a reviewer for you, use r? to override) |
pnkfelix
commented
Jun 4, 2021
oh wait I need a regression test too. :) |
This comment has been minimized.
This comment has been minimized.
d9ff911 to
1111edcComparepnkfelix
commented
Jun 4, 2021
This comment has been minimized.
This comment has been minimized.
Details
weird, my local build+tests passed. Looking now. Update: Oh, my local build driver script only runs |
…ntrinsics). This is to address issue 84297.
…pping`. Test was added in PR rust-lang#84404. The intent here is: The `copy`/`copy_overlapping` intrinsics are going through some flip-flopping now of "are they intrinsics or not". We can achieve the same effect that the test intended by using `likely`/`unlikely`.
(for the short term, that is; see issue 84297.)
85cb915 to
f08f933CompareMark-Simulacrum
commented
Jun 8, 2021
@bors r+ p=1 Mostly just reverting some stuff, including unstable const-fn-ing, but seems good. |
bors
commented
Jun 8, 2021
📌 Commit f08f933 has been approved by |
bors
commented
Jun 8, 2021
⌛ Testing commit f08f933 with merge 957453fc62205d24f9c5e331c4b68fe802e83797... |
bors
commented
Jun 8, 2021
💔 Test failed - checks-actions |
apiraino
commented
Jun 10, 2021
…r=dtolnay Beta targetted Make copy/copy_nonoverlapping fn's again beta backport of PR rust-lang#86003 to address issue rust-lang#84297
Mark-Simulacrum
commented
Jun 11, 2021
beta backported in #86203 |
rylev
commented
Jun 16, 2021
@pnkfelix@Mark-Simulacrum This change led to some moderate performance regressions. I imagine performance regressions are somewhat expected going from intrinsics to function calls as it seems LLVM might have more to process now. A quick look at where the regressions are happening shows it to be mostly in codegen. Any thoughts? |
Mark-Simulacrum
commented
Jun 16, 2021
This was a stopgap measure to fix regressions; it should be fixable in the long run. I don't think it makes sense to prioritize the work too much though. |
…Mark-Simulacrum Make copy/copy_nonoverlapping fn's again Make copy/copy_nonoverlapping fn's again, rather than intrinsics. This a short-term change to address issue rust-lang#84297. It effectively reverts PRs rust-lang#81167rust-lang#81238 (and part of rust-lang#82967), rust-lang#83091, and parts of rust-lang#79684.
…r=RalfJung Revert revert of constness in rust-lang#86003 Re-constify `mem::swap`, `mem::replace`, `ptr::write` which were marked as not `const` in rust-lang#86003 Once the checks pass, this should solve rust-lang#86236
Avoid using the `copy_nonoverlapping` wrapper through `mem::replace`. This is a much simpler way to achieve the pre-rust-lang#86003 behavior of `mem::replace` not needing dynamically-sized `memcpy`s (at least before inlining), than re-doing rust-lang#81238 (which needs rust-lang#86699 or something similar). I didn't notice it until recently, but `ptr::write` already explicitly avoided using the wrapper, while `ptr::read` just called the wrapper (and was the reason for us observing any behavior change from rust-lang#86003 in Rust-GPU). <hr/> The codegen test I've added fails without the change to `core::ptr::read` like this (ignore the `v0` mangling, I was using a worktree with it turned on by default, for this): ```llvm 13: ; core::intrinsics::copy_nonoverlapping::<u8> 14: ; Function Attrs: inlinehint nonlazybind uwtable 15: define internal void `@_RINvNtCscK5tvALCJol_4core10intrinsics19copy_nonoverlappinghECsaS4X3EinRE8_25mem_replace_direct_memcpy(i8*` %src, i8* %dst, i64 %count) unnamed_addr #0 { 16: start: 17: %0 = mul i64 %count, 1 18: call void `@llvm.memcpy.p0i8.p0i8.i64(i8*` align 1 %dst, i8* align 1 %src, i64 %0, i1 false) not:17 !~~~~~~~~~~~~~~~~~~~~~ error: no match expected 19: ret void 20: } ``` With the `core::ptr::read` change, `core::intrinsics::copy_nonoverlapping` doesn't get instantiated and the test passes. <hr/> r? `@m-ou-se` cc `@nagisa` (codegen test) `@oli-obk` / `@RalfJung` (miri diagnostic changes)
Make copy/copy_nonoverlapping fn's again, rather than intrinsics.
This a short-term change to address issue #84297.
It effectively reverts PRs #81167#81238 (and part of #82967), #83091, and parts of #79684.