remove no-longer-needed work-arounds from the standard library
This commit is contained in:
parent
eb4bdb00a4
commit
6b7f6b98c7
2 changed files with 9 additions and 18 deletions
|
@ -730,10 +730,7 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
|
||||||
// understanding `mem::replace`, `Option::take`, etc. - a better overall
|
// understanding `mem::replace`, `Option::take`, etc. - a better overall
|
||||||
// solution might be to make `ptr::swap_nonoverlapping` into an intrinsic, which
|
// solution might be to make `ptr::swap_nonoverlapping` into an intrinsic, which
|
||||||
// a backend can choose to implement using the block optimization, or not.
|
// a backend can choose to implement using the block optimization, or not.
|
||||||
// NOTE(scottmcm) MIRI is disabled here as reading in smaller units is a
|
#[cfg(not(any(target_arch = "spirv")))]
|
||||||
// pessimization for it. Also, if the type contains any unaligned pointers,
|
|
||||||
// copying those over multiple reads is difficult to support.
|
|
||||||
#[cfg(not(any(target_arch = "spirv", miri)))]
|
|
||||||
{
|
{
|
||||||
// For types that are larger multiples of their alignment, the simple way
|
// For types that are larger multiples of their alignment, the simple way
|
||||||
// tends to copy the whole thing to stack rather than doing it one part
|
// tends to copy the whole thing to stack rather than doing it one part
|
||||||
|
|
|
@ -908,11 +908,6 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(scottmcm) Miri is disabled here as reading in smaller units is a
|
|
||||||
// pessimization for it. Also, if the type contains any unaligned pointers,
|
|
||||||
// copying those over multiple reads is difficult to support.
|
|
||||||
#[cfg(not(miri))]
|
|
||||||
{
|
|
||||||
// Split up the slice into small power-of-two-sized chunks that LLVM is able
|
// Split up the slice into small power-of-two-sized chunks that LLVM is able
|
||||||
// to vectorize (unless it's a special type with more-than-pointer alignment,
|
// to vectorize (unless it's a special type with more-than-pointer alignment,
|
||||||
// because we don't want to pessimize things like slices of SIMD vectors.)
|
// because we don't want to pessimize things like slices of SIMD vectors.)
|
||||||
|
@ -923,7 +918,6 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
|
||||||
attempt_swap_as_chunks!(usize);
|
attempt_swap_as_chunks!(usize);
|
||||||
attempt_swap_as_chunks!(u8);
|
attempt_swap_as_chunks!(u8);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// SAFETY: Same preconditions as this function
|
// SAFETY: Same preconditions as this function
|
||||||
unsafe { swap_nonoverlapping_simple_untyped(x, y, count) }
|
unsafe { swap_nonoverlapping_simple_untyped(x, y, count) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue