[llvm-bugs] [Bug 38862] New: Optimize pass struct by value to tail call

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 7 00:07:48 PDT 2018


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

            Bug ID: 38862
           Summary: Optimize pass struct by value to tail call
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

struct A {
    int x[64];
};

void structByValue(A s);

void callStructByValue(A s) {
  structByValue(s);
}

Clang:
callStructByValue(A): # @callStructByValue(A)
  sub rsp, 264
  lea rsi, [rsp + 272]
  mov ecx, 32
  mov rdi, rsp
  rep movsq
  call structByValue(A)
  add rsp, 264
  ret

GCC:
callStructByValue(A):
  jmp     structByValue(A)



If I change code to:
struct A {
    int *x;
};

Clang tail calls it too.

-- 
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/20180907/2cc94563/attachment.html>


More information about the llvm-bugs mailing list