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

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).