libstdc++: Optimize std::uninitialized_move to use memcpy when possible.
`std::uninitialized_move` and `std::uninitialized_move_n` are optimized to use `memcpy` when iterators are pointers, improving performance.
std::uninitialized_move and std::uninitialized_move_n in libstdc++ are now optimized to use memcpy when the iterators are raw pointers. Previously, the optimization was missed because the move iterator wasn’t unwrapped before calling std::uninitialized_copy. This change improves performance when moving POD types.
In Details
std::uninitialized_move and std::uninitialized_move_n delegate to std::uninitialized_copy after wrapping iterators in std::move_iterator. The optimization in std::uninitialized_copy wasn't unwrapping the move iterator with __miter_base(), preventing the memcpy optimization when dealing with simple pointers. This commit fixes that, and adds a new test testsuite/20_util/specialized_algorithms/uninitialized_move/121789.cc.
For Context
std::uninitialized_move is a C++ standard library function that moves a range of objects from one memory location to another, without assuming the destination memory is initialized. This commit optimizes the implementation of this function in libstdc++ to use the faster memcpy function when dealing with raw pointers. This improves performance when moving plain data structures.