[libcxx-commits] [PATCH] D124328: [libc++] Forward more often to memmove in copy

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 27 19:54:21 PDT 2022


var-const requested changes to this revision.
var-const added a comment.
This revision now requires changes to proceed.

Is it possible to add some tests for this? For checking the optimization, perhaps use structs containing pointers to dynamically-allocated memory that have deep-copying constructors, then check that only the pointers themselves were copied?



================
Comment at: libcxx/include/__algorithm/copy.h:74
+                             && __is_trivially_copy_assignable_unwrapped<_OutIter>::value
+                             && __is_trivially_copy_assignable_unwrapped<_InIter>::value> >
 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
----------------
Nit: I think checking `_InIter` should happen before `_OutIter` for consistency with the argument order.


================
Comment at: libcxx/include/__algorithm/copy.h:105
+pair<reverse_iterator<reverse_iterator<_InIter> >, reverse_iterator<reverse_iterator<_OutIter> > >
+__copy_impl(reverse_iterator<reverse_iterator<_InIter>> __first,
+            reverse_iterator<reverse_iterator<_Sent>> __last,
----------------
Question: why wouldn't the other `reverse_iter` overload that calls `__unwrap_iter` handle the case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124328/new/

https://reviews.llvm.org/D124328



More information about the libcxx-commits mailing list