[libcxx-commits] [PATCH] D147741: [libc++, std::vector] call the optimized version of __uninitialized_allocator_copy for trivial types
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 27 10:20:18 PDT 2023
Mordante added a comment.
Looking at the benchmark this patch has a negative effect on the average times. Can you explain why that happens? Did you look at the generated assembly after your changes?
================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:607
+ } else {
+ return std::copy(__first1, __last1, const_cast<_RawType*>(__first2));
+ }
----------------
LLVM style is not `else` after a `return`, here and other places in this patch. Note the `if constexpr` does get the `else` to avoid generating unneeded code by the compiler.
================
Comment at: libcxx/include/vector:1036
+ using _RawType = __remove_const_t<_Tp>;
+ if constexpr(is_trivially_copy_constructible<_RawType>::value && is_trivially_copy_assignable<_RawType>::value &&
+ __allocator_has_trivial_copy_construct<_Allocator, _RawType>::value &&
----------------
Please look for other `::value`s to. Since C++17 they all support the `_v` suffix.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147741/new/
https://reviews.llvm.org/D147741
More information about the libcxx-commits
mailing list