[libcxx-commits] [PATCH] D72704: Optimize basic_string::operator=(const basic_string&) for SSO assignments

Martijn Vels via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 15 09:15:47 PST 2020


mvels updated this revision to Diff 238290.
mvels added a comment.

Scoped for pathological case to be handled outline


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72704

Files:
  libcxx/include/string


Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -2266,7 +2266,11 @@
     if (this != &__str)
     {
         __copy_assign_alloc(__str);
-        return assign(__str.data(), __str.size());
+        const bool __str_is_long = __str.__is_long();
+        if (__str_is_long || __is_long()) {
+          return assign(__str.data(), __str.size());
+        }
+        __r_.first().__r = __str.__r_.first().__r;
     }
     return *this;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72704.238290.patch
Type: text/x-patch
Size: 539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200115/183a0c95/attachment.bin>


More information about the libcxx-commits mailing list