[LLVMbugs] [Bug 11787] New: Unneeded copy when passing by value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 17 12:07:26 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11787

             Bug #: 11787
           Summary: Unneeded copy when passing by value
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jmuizelaar at mozilla.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code:

typedef struct  {
    struct { double x; double y; double z; double w; } a;
    struct { double x; double y; double z; double w; } b;
    struct { double x; double y; double z; double w; } c;
    struct { double x; double y; double z; double w; } d;
} matrix;
matrix make_matrix();
void set_matrix(matrix);
void p()
{
    matrix k = make_matrix();
    set_matrix(k);
}

generates this:
_p:                                     ## @p
        pushq   %rbp
        movq    %rsp, %rbp
        pushq   %rbx
        subq    $264, %rsp              ## imm = 0x108
        leaq    -136(%rbp), %rbx
        movq    %rbx, %rdi
        xorb    %al, %al
        callq   _make_matrix
        movl    $16, %ecx
        movq    %rsp, %rdi
        movq    %rbx, %rsi
        rep;movsq
        callq   _set_matrix
        addq    $264, %rsp              ## imm = 0x108
        popq    %rbx
        popq    %rbp
        ret

It would be nice if we could avoid the copy of the matrix

-- 
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