[llvm-bugs] [Bug 44377] New: Missing tail call for memcpy create by LoopIdiomRecognizer

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 24 13:58:33 PST 2019


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

            Bug ID: 44377
           Summary: Missing tail call for memcpy create by
                    LoopIdiomRecognizer
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

void f(unsigned char*__restrict p,unsigned char*__restrict q,int n){
  for(int i=0;i<n;++i)
    p[i]=q[i];
}

Current -O3 codegen:
f(unsigned char*, unsigned char*, int): # @f(unsigned char*, unsigned char*,
int)
  test edx, edx
  jle .LBB0_2
  push rax
  mov edx, edx
  call memcpy
  add rsp, 8
.LBB0_2:
  ret

But we could have a tail cail here:
f(unsigned char*, unsigned char*, int): # @f(unsigned char*, unsigned char*,
int)
  test edx, edx
  je .LBB0_1
  movsxd rdx, edx
  jmp memcpy # TAILCALL
.LBB0_1:
  ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191224/431c622e/attachment-0001.html>


More information about the llvm-bugs mailing list