public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/64458] New: [ARM] Redundant ldr when accessing var inside and outside a loop
@ 2014-12-31 16:33 thopre01 at gcc dot gnu.org
2015-01-16 14:29 ` [Bug target/64458] " ramana at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-12-31 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64458
Bug ID: 64458
Summary: [ARM] Redundant ldr when accessing var inside and
outside a loop
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: thopre01 at gcc dot gnu.org
Target: arm-none-eabi
When compiling the below example with -O2, 2 ldr are generated to access the
variable "some": one for the loop and one for the store.
int f (int);
unsigned int glob;
void
g (void)
{
while (glob);
glob = 1;
}
The following code is then generated:
0: push
{r4, lr}
4: ldr r4, pc, #32 ; 2c
8: ldr r0, [r4]
c: bl 0 <g>
10: cmp r0, #0
14: ldr r3, pc, #16 ; 2c
18: bne 8
1c: mov r2, #1
20: pop {r4, lr}
24: str r2, [r3]
28: bx lr
2c: .word 0x00000000
Note the redundant load of the address at offset 2c in instructions at offsets
4 and 14.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/64458] [ARM] Redundant ldr when accessing var inside and outside a loop
2014-12-31 16:33 [Bug target/64458] New: [ARM] Redundant ldr when accessing var inside and outside a loop thopre01 at gcc dot gnu.org
@ 2015-01-16 14:29 ` ramana at gcc dot gnu.org
2015-01-28 2:43 ` thopre01 at gcc dot gnu.org
2015-01-28 2:46 ` thopre01 at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-01-16 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64458
Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2015-01-16
CC| |ramana at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Huh, what arch options ?
.arm
.syntax divided
.file "ldr.c"
.text
.align 2
.global g
.type g, %function
g:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r2, .L5
ldr r3, [r2]
.L2:
cmp r3, #0
bne .L2
mov r3, #1
str r3, [r2]
bx lr
.L6:
.align 2
.L5:
.word glob
.size g, .-g
.comm glob,4,4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/64458] [ARM] Redundant ldr when accessing var inside and outside a loop
2014-12-31 16:33 [Bug target/64458] New: [ARM] Redundant ldr when accessing var inside and outside a loop thopre01 at gcc dot gnu.org
2015-01-16 14:29 ` [Bug target/64458] " ramana at gcc dot gnu.org
@ 2015-01-28 2:43 ` thopre01 at gcc dot gnu.org
2015-01-28 2:46 ` thopre01 at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2015-01-28 2:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64458
Thomas Preud'homme <thopre01 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
*** This bug has been marked as a duplicate of bug 64616 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/64458] [ARM] Redundant ldr when accessing var inside and outside a loop
2014-12-31 16:33 [Bug target/64458] New: [ARM] Redundant ldr when accessing var inside and outside a loop thopre01 at gcc dot gnu.org
2015-01-16 14:29 ` [Bug target/64458] " ramana at gcc dot gnu.org
2015-01-28 2:43 ` thopre01 at gcc dot gnu.org
@ 2015-01-28 2:46 ` thopre01 at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2015-01-28 2:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64458
--- Comment #3 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
Hi Ramana,
As said in PR64616, this happens with the default cpu selected when configuring
with --with-arch=armv7-a.
Best regards.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-28 2:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-31 16:33 [Bug target/64458] New: [ARM] Redundant ldr when accessing var inside and outside a loop thopre01 at gcc dot gnu.org
2015-01-16 14:29 ` [Bug target/64458] " ramana at gcc dot gnu.org
2015-01-28 2:43 ` thopre01 at gcc dot gnu.org
2015-01-28 2:46 ` thopre01 at gcc dot gnu.org
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).