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: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to