https://bugs.llvm.org/show_bug.cgi?id=46734

            Bug ID: 46734
           Summary: Failure to optimize __builtin___memcpy_chk optimally
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

void *f(void *d, const void *s, size_t l)
{
  return __builtin___memcpy_chk(d, s, l, __builtin_object_size(d, 0));
}

With -O3, GCC outputs this :

f(void*, void const*, unsigned long):
  jmp memcpy

LLVM outputs this :

f(void*, void const*, unsigned long):
  push rbx
  mov rbx, rdi
  call memcpy
  mov rax, rbx
  pop rbx
  ret

The same bad code generation can be seen with the same code, but using
`__builtin___memmove_chk` instead of `__builtin___memcpy_chk`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to