remove no-longer-needed work-arounds from the standard library
This commit is contained in:
parent
eb4bdb00a4
commit
6b7f6b98c7
@ -730,10 +730,7 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
|
||||
// understanding `mem::replace`, `Option::take`, etc. - a better overall
|
||||
// solution might be to make `ptr::swap_nonoverlapping` into an intrinsic, which
|
||||
// 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
|
||||
// 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)))]
|
||||
#[cfg(not(any(target_arch = "spirv")))]
|
||||
{
|
||||
// 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
|
||||
|
@ -908,21 +908,15 @@ macro_rules! attempt_swap_as_chunks {
|
||||
);
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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.)
|
||||
if mem::align_of::<T>() <= mem::size_of::<usize>()
|
||||
&& (!mem::size_of::<T>().is_power_of_two()
|
||||
|| mem::size_of::<T>() > mem::size_of::<usize>() * 2)
|
||||
{
|
||||
// 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,
|
||||
// because we don't want to pessimize things like slices of SIMD vectors.)
|
||||
if mem::align_of::<T>() <= mem::size_of::<usize>()
|
||||
&& (!mem::size_of::<T>().is_power_of_two()
|
||||
|| mem::size_of::<T>() > mem::size_of::<usize>() * 2)
|
||||
{
|
||||
attempt_swap_as_chunks!(usize);
|
||||
attempt_swap_as_chunks!(u8);
|
||||
}
|
||||
attempt_swap_as_chunks!(usize);
|
||||
attempt_swap_as_chunks!(u8);
|
||||
}
|
||||
|
||||
// SAFETY: Same preconditions as this function
|
||||
|
Loading…
Reference in New Issue
Block a user