public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "herbert at gondor dot apana dot org dot au" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/23451] [3.4/4.0/4.1/4.2 regression] Redundant reloading from stack frame
Date: Tue, 10 Jan 2006 22:44:00 -0000	[thread overview]
Message-ID: <20060110224432.6598.qmail@sourceware.org> (raw)
In-Reply-To: <bug-23451-5724@http.gcc.gnu.org/bugzilla/>



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



  parent reply	other threads:[~2006-01-10 22:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23451-5724@http.gcc.gnu.org/bugzilla/>
2005-10-31  5:05 ` [Bug target/23451] [3.4/4.0/4.1 " mmitchel at gcc dot gnu dot org
2006-01-10 20:36 ` [Bug target/23451] [3.4/4.0/4.1/4.2 " steven at gcc dot gnu dot org
2006-01-10 20:57 ` steven at gcc dot gnu dot org
2006-01-10 21:27 ` steven at gcc dot gnu dot org
2006-01-10 21:33 ` steven at gcc dot gnu dot org
2006-01-10 22:44 ` herbert at gondor dot apana dot org dot au [this message]
2006-01-10 22:58 ` steven at gcc dot gnu dot org
2006-01-10 23:00 ` steven at gcc dot gnu dot org
2006-01-10 23:00 ` steven at gcc dot gnu dot org
2006-01-10 23:01 ` steven at gcc dot gnu dot org
2006-01-10 23:02 ` steven at gcc dot gnu dot org
2006-01-10 23:04 ` steven at gcc dot gnu dot org
2006-01-10 23:25 ` herbert at gondor dot apana dot org dot au
2006-01-10 23:36 ` steven at gcc dot gnu dot org
2006-01-10 23:41 ` herbert at gondor dot apana dot org dot au
2006-01-10 23:44 ` [Bug target/23451] Redundant reloading from stack frame on i386 steven at gcc dot gnu dot org
2006-01-10 23:45 ` herbert at gondor dot apana dot org dot au
2006-01-29 18:09 ` pinskia at gcc dot gnu dot org
2009-04-22 23:06 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060110224432.6598.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).