[Issue 7963] dmd doesn't inline std.algorithm.swap on a 'alias this' struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 20 09:23:52 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=7963

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp at gmx.com
           Hardware|x86                         |All
         Resolution|---                         |FIXED
                 OS|Windows                     |All

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
It does now:

void test()
{
    auto f1 = Foo([1, 2]);
    auto f2 = Foo([1, 2]);
    swap(f1, f2);
}


;------- SUB 000000000045A858h -------
000000000045A858h  push rbp
000000000045A859h  mov rbp, rsp
000000000045A85Ch  sub rsp, 28h
000000000045A860h  mov qword ptr [rbp-28h], rbx
000000000045A864h  mov eax, 00000001h
000000000045A869h  mov dword ptr [rbp-18h], eax
000000000045A86Ch  mov ecx, 00000002h
000000000045A871h  mov dword ptr [rbp-14h], ecx
000000000045A874h  lea rsi, qword ptr [rbp-18h]
000000000045A878h  mov cl, 08h
000000000045A87Ah  lea rdi, qword ptr [rbp-20h]
000000000045A87Eh  rep movsb 
000000000045A880h  mov dword ptr [rbp-08h], eax
000000000045A883h  mov dword ptr [rbp-04h], 00000002h
000000000045A88Ah  lea rsi, qword ptr [rbp-08h]
000000000045A88Eh  mov ecx, 00000008h
000000000045A893h  lea rdi, qword ptr [rbp-10h]
000000000045A897h  rep movsb 
000000000045A899h  lea rax, qword ptr [rbp-20h]
000000000045A89Dh  lea rdx, qword ptr [rbp-10h]
000000000045A8A1h  mov rbx, qword ptr [rax]
000000000045A8A4h  mov rcx, qword ptr [rdx]
000000000045A8A7h  mov qword ptr [rax], rcx
000000000045A8AAh  mov qword ptr [rdx], rbx
000000000045A8ADh  mov rbx, qword ptr [rbp-28h]
000000000045A8B1h  leave 
000000000045A8B2h  ret 
;-------------------------------------

--


More information about the Digitalmars-d-bugs mailing list