[LLVMbugs] [Bug 3598] New: [clang codegen perf] Don' t pass _Complex with byval if you can avoid it

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Feb 16 18:03:13 PST 2009


           Summary: [clang codegen perf] Don't pass _Complex with byval if
                    you can avoid it
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: code-quality
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu

clang codegens a call to cacos with byval, which pins an alloca to the stack:

_Complex double foo2(_Complex double x) {
  return cacosl(x);

This causes us to compile this to:

        subl    $60, %esp
        movsd   76(%esp), %xmm0
        movsd   68(%esp), %xmm1
        movsd   %xmm1, 24(%esp)
        movsd   %xmm0, 32(%esp)
        movl    36(%esp), %eax
        movl    %eax, 16(%esp)
        movl    32(%esp), %eax
        movl    %eax, 12(%esp)
        movl    28(%esp), %eax
        movl    %eax, 8(%esp)
        movl    24(%esp), %eax
        movl    %eax, 4(%esp)
        leal    40(%esp), %eax
        movl    %eax, (%esp)
        call    _cacos
        subl    $4, %esp
        movsd   48(%esp), %xmm0
        movsd   40(%esp), %xmm1
        movl    64(%esp), %eax
        movsd   %xmm1, (%eax)
        movsd   %xmm0, 8(%eax)
        addl    $60, %esp
        ret     $4

llvm-gcc doesn't do this.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list