[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug target/23451] [3.4/4.0/4.1/4.2 regression] Redundant reloading from stack frame




------- Comment #7 from herbert at gondor dot apana dot org dot au  2006-01-10 22:44 -------
Subject: Re:  [3.4/4.0/4.1/4.2 regression] Redundant reloading from stack frame

On Tue, Jan 10, 2006 at 09:32:58PM -0000, steven at gcc dot gnu dot org wrote:
> 
> ------- Comment #6 from steven at gcc dot gnu dot org  2006-01-10 21:32 -------
> Since GCC 3.2 also has this problem, contrary to what the reporter claims, I am
> not sure if we should keep this marked as a regression.  Obviously it is a
> missed optimization, so the bug report is valid in that sense, and we should
> keep it open at least.

gcc-3.2 keeps the value in %esi and therefore avoids the problem:

        .file   "a.c"
        .section        .rodata.str1.1,"aMS",@progbits,1
.LC0:
        .string "%.*s: bad variable name"
        .text
        .p2align 2,,3
.globl setvar
        .type   setvar,@function
setvar:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %edi
        pushl   %esi
        pushl   %ebx
        subl    $24, %esp
        movl    8(%ebp), %ebx
        movl    16(%ebp), %eax
        movl    12(%ebp), %esi

Only one load.

        movl    %eax, -16(%ebp)
        pushl   %ebx
        call    endofname
        subl    $8, %esp
        pushl   $61
        pushl   %eax
        movl    %eax, %edi
        call    strchrnul
        movl    %eax, %edx
        addl    $32, %esp
        subl    %ebx, %edx
        je      .L3
        cmpl    %edi, %eax
        jne     .L3
        xorl    %edi, %edi
        testl   %esi, %esi
        je      .L7
        movl    %esi, %edi
        cld
        movl    $-1, %ecx
        xorl    %eax, %eax
        repnz
        scasb
        notl    %ecx
        leal    -1(%ecx), %edi
.L5:
        pushl   %ecx
        pushl   %edx
        pushl   %ebx
        leal    2(%edi,%edx), %eax
        pushl   %eax
        call    malloc
        movl    %eax, (%esp)
        movl    %eax, %ebx
        call    mempcpy
        addl    $16, %esp
        testl   %esi, %esi
        je      .L6
        movb    $61, (%eax)
        pushl   %edx
        pushl   %edi
        pushl   %esi
        incl    %eax
        pushl   %eax
        call    mempcpy
        addl    $16, %esp
.L6:
        movb    $0, (%eax)
        orl     $1, -16(%ebp)
        movl    -16(%ebp), %eax
        movl    %eax, 12(%ebp)
        movl    %ebx, 8(%ebp)
        leal    -12(%ebp), %esp
        popl    %ebx
        popl    %esi
        popl    %edi
        leave
        jmp     setvareq
        .p2align 2,,3
.L7:
        orl     $2, -16(%ebp)
        jmp     .L5
.L3:
        pushl   %esi
        pushl   %ebx
        pushl   %edx
        pushl   $.LC0
        call    sh_error
.Lfe1:
        .size   setvar,.Lfe1-setvar
        .ident  "GCC: (GNU) 3.2.3 (Debian)"

Thanks,


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23451

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.



Reply to: