[LLVMbugs] [Bug 11703] New: poor x86-64 register allocation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 4 04:19:59 PST 2012


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

             Bug #: 11703
           Summary: poor x86-64 register allocation
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Register Allocator
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I get:

$ echo "unsigned f(unsigned x) { return (x >> 1) + (x & 1); }" | clang -O3 -S
-o - -x c -
...
# BB#0:                                 # %entry
    movl    %edi, %eax
    andl    $1, %eax
    shrl    %edi
    addl    %eax, %edi
    movl    %edi, %eax
    ret
...

This seems like poor register allocation, because the last two instructions
before the ret could be replaced with:

    addl    %edi, %eax

I'm using trunk rev 147529 on Ubuntu 11.10 x86-64.

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