https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91101

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
The issue is that __asan_stack_malloc_0 function is very high in perf profile:

# Overhead  Command          Shared Object             Symbol                   
# ........  ...............  ........................ 
........................................................................
#
    91.97%  test-conf-parse  libasan.so.5.0.0          [.]
__asan_stack_malloc_0
     7.00%  test-conf-parse  libsystemd-shared-242.so  [.] config_parse
     0.12%  test-conf-parse  libsystemd-shared-242.so  [.] read_line_full
     0.11%  test-conf-parse  libc-2.29.so              [.] _IO_getc
     0.10%  test-conf-parse  libc-2.29.so              [.] __strlen_avx2
     0.08%  test-conf-parse  libsystemd-shared-242.so  [.] safe_fgetc
     0.07%  test-conf-parse  libsystemd-shared-242.so  [.] categorize_eol

perf annotate says:
         :           Disassembly of section .text:
         :
         :           0000000000034a00 <__asan_stack_malloc_0>:
         :           __asan_stack_malloc_0():
         :             extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
__asan_stack_free_##class_id(  \
         :                 uptr ptr, uptr size) {                              
                    \
         :               OnFree(ptr, class_id, size);                          
                    \
         :             }
...

         :           _ZN6__asan9FakeStack8AllocateEmmm():
         :               GC(real_stack);
    0.00 :   34b30:       mov    %rbp,%rsi
    0.00 :   34b33:       mov    %rax,%rdi
    0.00 :   34b36:       callq  34800 <__asan::FakeStack::GC(unsigned long)>
    0.00 :   34b3b:       jmpq   34a2c <__asan_stack_malloc_0+0x2c>
         :             for (int i = 0; i < num_iter; i++) {
    0.00 :   34b40:       xor    %ecx,%ecx
    0.12 :   34b42:       add    $0x1,%ecx
   17.35 :   34b45:       cmp    %ecx,%r8d
   17.95 :   34b48:       je     34b70 <__asan_stack_malloc_0+0x170>
         :               uptr pos = ModuloNumberOfFrames(stack_size_log,
class_id, hint_position++);
    0.00 :   34b4a:       mov    %rdx,%rax
    0.01 :   34b4d:       add    $0x1,%rdx
         :           _ZN6__asan9FakeStack20ModuloNumberOfFramesEmmm():
         :               return n & (NumberOfFrames(stack_size_log, class_id) -
1);
    0.01 :   34b51:       and    %rsi,%rax
         :           _ZN6__asan9FakeStack8AllocateEmmm():
    0.03 :   34b54:       mov    %rdx,(%rbx)
         :               if (flags[pos]) continue;
    0.10 :   34b57:       lea    0x1000(%rbx,%rax,1),%rdi
   31.71 :   34b5f:       cmpb   $0x0,(%rdi)
   32.65 :   34b62:       je     34a72 <__asan_stack_malloc_0+0x72>
    0.00 :   34b68:       jmp    34b42 <__asan_stack_malloc_0+0x142>
    0.00 :   34b6a:       nopw   0x0(%rax,%rax,1)

Reply via email to