[LLVMbugs] [Bug 10221] New: Poor register allocation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 28 20:28:12 PDT 2011


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

           Summary: Poor register allocation
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jmuizelaar at mozilla.com
                CC: llvmbugs at cs.uiuc.edu


This code:

void foo(float x, float y);
int finit(double);
int
nsSVGPathElementCreateSVGPathSegMovetoAbs(float x, float y, void **_retval)
{
    if (!finit((x)+(y))) {
    return 5;
  }

  foo(x, y);
  return 0;
}

Compiles to:

__ at _Z41nsSVGPathElementCreateSVGPathSegMovetoAbsffPPv
    pushq    %rax
    movaps    %xmm1, %xmm2
    movaps    %xmm0, %xmm1
    movaps    %xmm1, %xmm0

We move and then move back?

    movss    %xmm1, 4(%rsp)          ## 4-byte Spill
    addss    %xmm2, %xmm0
    movss    %xmm2, (%rsp)           ## 4-byte Spill

We also shouldn't need to use xmm2 here above

    cvtss2sd    %xmm0, %xmm0
    callq    __Z5finitd
    movl    %eax, %ecx
    movl    $5, %eax
    testl    %ecx, %ecx
    je    LBB0_2
    movss    4(%rsp), %xmm0          ## 4-byte Reload
    movss    (%rsp), %xmm1           ## 4-byte Reload
    callq    __Z3fooff
    xorl    %eax, %eax
    addq    $8, %rsp
    ret

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