From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3729 invoked by alias); 11 Jan 2010 08:23:09 -0000 Received: (qmail 3615 invoked by alias); 11 Jan 2010 08:22:57 -0000 Date: Mon, 11 Jan 2010 08:23:00 -0000 Message-ID: <20100111082257.3614.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/40730] redundant memory load In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "stevenb dot gcc at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-01/txt/msg01199.txt.bz2 ------- Comment #11 from stevenb dot gcc at gmail dot com 2010-01-11 08:22 ------- Subject: Re: redundant memory load On Mon, Jan 11, 2010 at 7:47 AM, carrot at google dot com wrote: >> iterate: >> push {lr} >> ldr r3, [r1] >> .L6: >> str r3, [r0] >> sub r2, r3, #0 >> bne .L5 >> b .L3 >> .L4: >> ldr r3, [r3, #8] >> b .L6 >> .L5: >> ldr r1, [r3, #4] >> cmp r1, #0 >> beq .L4 >> .L3: >> str r2, [r0, #12] >> @ sp needed for prologue >> pop {pc} >> >> Carrot, could you please double-check that this is still correct code? >> > > Yes, it is correct. > There are still 13 instructions, I think it is related to unoptimized basic > block order. Yes, I would have expected the block starting with .L4 to be *after* the block starting with .L5, something like so: iterate: push {lr} ldr r3, [r1] .L6: str r3, [r0] sub r2, r3, #0 beq .L3 .L5: ldr r1, [r3, #4] cmp r1, #0 bne .L3 ldr r3, [r3, #8] b .L6 .L3: str r2, [r0, #12] @ sp needed for prologue pop {pc} Does that look correct? And if so, could you see if there is an open bug report about this; or otherwise file a new PR and add me to the CC-list? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40730