[LLVMbugs] [Bug 233] [llvmgcc] Structure copies result in a LOT of code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Feb 12 13:15:38 PST 2004


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=233

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sabre at nondot.org  2004-02-12 15:15 -------
Fixed.  Patch here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040209/011557.html

Here's the testcase:
test/Regression/CFrontend/2004-02-12-LargeAggregateCopy.c.tr

For this test:
----
struct X { int V[10000]; };
struct X Global1, Global2;
void test() {
  memcpy(&Global1, &Global2, sizeof(Global2));
  Global2 = Global1;
}
----

We now generate the following X86 code, which is substantially better than GCC:


$ llvmgcc test2.c -c -o - | llc -regalloc=linearscan
        .intel_syntax
        .text
        .align 16
        .globl test
        .type  test, @function
test:
.LBB0:  # entry
        sub %ESP, 12
        mov DWORD PTR [%ESP + 8], %ESI
        mov DWORD PTR [%ESP + 4], %EDI
        mov %ECX, 40000
        mov %EDI, OFFSET Global1
        mov %ESI, OFFSET Global2
        rep movsb 
        mov %ECX, 10000
        mov %EDI, OFFSET Global2
        mov %ESI, OFFSET Global1
        rep movsd 
        # FP_REG_KILL
        mov %EDI, DWORD PTR [%ESP + 4]
        mov %ESI, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret 

        .data
        .comm Global1,40000,4           # %struct.X* %Global1
        .comm Global2,40000,4           # %struct.X* %Global2

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list