From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6614 invoked by alias); 10 Jan 2006 22:44:34 -0000 Received: (qmail 6599 invoked by alias); 10 Jan 2006 22:44:32 -0000 Date: Tue, 10 Jan 2006 22:44:00 -0000 Message-ID: <20060110224432.6598.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/23451] [3.4/4.0/4.1/4.2 regression] Redundant reloading from stack frame In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "herbert at gondor dot apana dot org dot au" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg01006.txt.bz2 List-Id: ------- 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