[libcxx-commits] [libcxx] [ASan][libc++] String annotations optimizations fix with lambda (PR #76200)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 8 08:54:46 PST 2024


AdvenamTacet wrote:

Difference between no string annotations and current head with flags `-stdlib=libc++ -fsanitize=undefined -O3 -std=c++23 -fno-omit-frame-pointer` from the previous post: https://godbolt.org/z/GnY3zq13K Notice that there is NO `-fsanitize=address`, so we compile without ASan.

Example (but not only) difference:
```asm
        mov     byte ptr [rdi], r15b
        movzx   eax, byte ptr [rbp - 33]
        mov     byte ptr [rdi + 1], al
        mov     eax, dword ptr [rbp - 40]
        mov     dword ptr [rdi + 2], eax
        movzx   eax, word ptr [rbp - 36]
        mov     word ptr [rdi + 6], ax
        mov     qword ptr [rdi + 8], r14
        mov     qword ptr [rdi + 16], rbx
```
        
is changed to
        
```asm
        mov     byte ptr [rbx], r14b
        movzx   eax, byte ptr [rbp - 33]
        mov     byte ptr [rbx + 1], al
        mov     eax, dword ptr [rbp - 40]
        mov     dword ptr [rbx + 2], eax
        movzx   eax, word ptr [rbp - 36]
        mov     word ptr [rbx + 6], ax
        mov     qword ptr [rbx + 8], r12
        mov     qword ptr [rbx + 16], rdi
        mov     byte ptr [rbp - 33], 0
        mov     dword ptr [rbp - 40], 0
        mov     word ptr [rbp - 36], 0
        xor     edi, edi
        xor     r15d, r15d
        test    r15b, r15b
        je      .LBB1_16
```

But when we apply this PR, there is no difference between ASm before annotations were added and the new one: https://godbolt.org/z/Mb4bKsoGW

https://github.com/llvm/llvm-project/pull/76200


More information about the libcxx-commits mailing list