From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16963 invoked by alias); 10 Jan 2006 21:27:52 -0000 Received: (qmail 16944 invoked by uid 48); 10 Jan 2006 21:27:51 -0000 Date: Tue, 10 Jan 2006 21:27:00 -0000 Message-ID: <20060110212751.16943.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: "steven at gcc dot gnu dot org" 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/msg00988.txt.bz2 List-Id: ------- Comment #5 from steven at gcc dot gnu dot org 2006-01-10 21:27 ------- FWIW, the peephole that we trigger is this one, which has been around since forever (since rth's ia32 backend rewrite from the previous century...): ;; Don't compare memory with zero, load and use a test instead. (define_peephole2 [(set (match_operand 0 "flags_reg_operand" "") (match_operator 1 "compare_operator" [(match_operand:SI 2 "memory_operand" "") (const_int 0)])) (match_scratch:SI 3 "r")] "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size" [(set (match_dup 3) (match_dup 2)) (set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))] "") But it feels like someone made a bad joke, or something. These are some pieces of what GCC 3.2 makes of it (with -march=i[456]86): movl -16(%ebp), %eax xorl %edi, %edi testl %eax, %eax je .L7 subl $12, %esp movl -16(%ebp), %eax pushl %eax call strlen and movl -16(%ebp), %esi addl $16, %esp testl %esi, %esi je .L6 movb $61, (%eax) pushl %ecx pushl %edi movl -16(%ebp), %edx This is on AMD64 -m32 with "GNU C version 3.2.3 (x86_64-unknown-linux-gnu)", compiled by gcc 3.3-hammer-branch, gcc 3.4 and later can't compile gcc 3.2. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23451