[libcxx-commits] [PATCH] D67524: P1144 "Trivially relocatable" (3/3): optimize std::vector for trivially relocatable types
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 12 14:53:33 PDT 2019
Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, zoecarver.
Herald added subscribers: libcxx-commits, dexonsmith.
Quuxplusone edited the summary of this revision.
Part 0/3 is D50119 <https://reviews.llvm.org/D50119>: it adds `__has_extension(__is_trivially_relocatable)` to the compiler.
Part 1/3 is D61761 <https://reviews.llvm.org/D61761>: it implements the library traits and algorithms mandated by P1144 <https://reviews.llvm.org/P1144>.
Part 2/3 is D63620 <https://reviews.llvm.org/D63620>: it implements Quality-of-Implementation features to warrant certain std library types as "trivially relocatable."
Part 3/3 is D67524 <https://reviews.llvm.org/D67524>: it implements Quality-of-Implementation features to optimize certain std library functions for better performance on types that have been warranted "trivially relocatable."
This patch has no ABI implications (or if it does, that's a bug, please tell me about it).
TODO: Actually understand all the situations in which `__move_range` can be called, and split out the ones where `memmove` is a viable solution. Right now I just handle one special case.
Notes on optimizations that I've made for https://p1144.godbolt.org/z/q2N_Ln but which are //not// part of this patch:
- `std::any` can be made trivially relocatable, by changing `_IsSmallObject` to be `false` for non-trivially-relocatable types. However, that would break ABI.
- `std::swap` can be taught to use the-moral-equivalent-of-`memswap` for trivially relocatable types. However, `std::swap` is required to be `constexpr` in C++17 and later. Therefore we must wait for `std::is_constant_evaluated()` before pursuing runtime `std::swap` optimizations.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 9451 bytes
Desc: not available
More information about the libcxx-commits