On Thu, Jul 19, 2018 at 10:01 AM Glen Fernandes wrote: > > I was still unclear about that, but I forwarded you an e-mail from > Marshall with his answer when I asked whether libc++'s use of > TriviallyCopyAssignable here was incorrect. Let me know if it applies > here, and if not (and that interpretation of the standard is > incorrect), I'll update the patch to do as you suggest and run the > tests again. > > Glen
Attached: patch.txt Use __builtin_memmove for trivially copyable types 2018-07-19 Glen Joseph Fernandes <glenj...@gmail.com> * include/bits/stl_algobase.h (__copy_move_a): Used __is_trivially_copyable. (__copy_move_backward_a): Likewise. Tested x86_64-pc-linux-gnu. Glen
commit 60bf5acca419df37752336c2008123558627ece7 Author: Glen Fernandes <glen.fernan...@gmail.com> Date: Thu Jul 19 10:27:54 2018 -0400 Use __builtin_memmove for trivially copyable types 2018-07-19 Glen Joseph Fernandes <glenj...@gmail.com> * include/bits/stl_algobase.h (__copy_move_a): Used __is_trivially_copyable. (__copy_move_backward_a): Likewise. diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 16a3f83b6..f0130bc41 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -389,11 +389,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __copy_move_a(_II __first, _II __last, _OI __result) { typedef typename iterator_traits<_II>::value_type _ValueTypeI; typedef typename iterator_traits<_OI>::value_type _ValueTypeO; typedef typename iterator_traits<_II>::iterator_category _Category; - const bool __simple = (__is_trivial(_ValueTypeI) + const bool __simple = (__is_trivially_copyable(_ValueTypeI) && __is_pointer<_II>::__value && __is_pointer<_OI>::__value && __are_same<_ValueTypeI, _ValueTypeO>::__value); return std::__copy_move<_IsMove, __simple, @@ -591,11 +591,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) { typedef typename iterator_traits<_BI1>::value_type _ValueType1; typedef typename iterator_traits<_BI2>::value_type _ValueType2; typedef typename iterator_traits<_BI1>::iterator_category _Category; - const bool __simple = (__is_trivial(_ValueType1) + const bool __simple = (__is_trivially_copyable(_ValueType1) && __is_pointer<_BI1>::__value && __is_pointer<_BI2>::__value && __are_same<_ValueType1, _ValueType2>::__value); return std::__copy_move_backward<_IsMove, __simple,