[libc++] Add __default_init_tag to basic_string constructors
This removes unneeded zero initialization of string data. For example, given the below code: void Init(void *mem) { new (mem) std::string("Hello World"); } Assembly before: Init(void*): xorps xmm0, xmm0 movups xmmword ptr [rdi], xmm0 mov qword ptr [rdi + 16], 0 mov byte ptr [rdi], 22 movabs rax, 8022916924116329800 mov qword ptr [rdi + 1], rax mov dword ptr [rdi + 8], 1684828783 mov byte ptr [rdi + 12], 0 ret Assembly after: Init(): mov byte ptr [rdi], 22 movabs rax, 8022916924116329800 mov qword ptr [rdi + 1], rax mov dword ptr [rdi + 8], 1684828783 mov byte ptr [rdi + 12], 0 ret Patch by Martijn Vels (mvels@google.com) Reviewed as https://reviews.llvm.org/D70621
Loading
Please register or sign in to comment