This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/40730] redundant memory load
- From: "stevenb dot gcc at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2010 08:22:57 -0000
- Subject: [Bug target/40730] redundant memory load
- References: <bug-40730-17659@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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
<gcc-bugzilla@gcc.gnu.org> 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