[libcxx-commits] [PATCH] D72986: Removed pathological case
Martijn Vels via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jan 18 14:07:45 PST 2020
mvels created this revision.
Herald added subscribers: libcxx-commits, christof.
Herald added a project: libc++.
Merge branch 'master' into string-optimize-assign-string
Add basic_string::__assign_str_noalias_external(const value_type* s, size_type n)
This change introduces the `__assign_str_noalias_external` which is invoked on the slow path from basic_string::operator=(const basic_string&).
The function is optimized for the source never aliassing the destination, the size always being inside the max_size, and have well predicted branches for non pathological assignments, i.e.: short --> long.
Merge branch 'master' into string-optimize-assign-string
Add basic_string::__string_assign_str_noalias_external
This changes adds the `__string_assign_str_noalias_external` function which is now used by the `operator=(const basic_string&)` method as a slow path if either of the strings is a long string.
`__string_assign_str_noalias_external` is optimized for being called from the operator= method: no alias into `this`, input has terminating zero as s[n], and size does not exceed max size. The branch in the external instantiated code should be well predicted.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72986
Files:
libcxx/include/__string
libcxx/include/string
libcxx/src/string.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72986.238966.patch
Type: text/x-patch
Size: 4035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200118/d571a267/attachment.bin>
More information about the libcxx-commits
mailing list