https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65326

            Bug ID: 65326
           Summary: LRA missing a Thumb optimization.
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthew.wahab at arm dot com

Created attachment 34964
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34964&action=edit
Testcase showing change in behaviour.

The ARM backend no longer supports -mno-lra so only the LRA is available. This
has also removed the Thumb mode optimiziation introduced in
https://gcc.gnu.org/ml/gcc-patches/2005-08/msg01140.html to fix PR 23436.

This turns sequences like
     mov    r3, r9
    mov    r2, r10
    ldr    r0, [r3, r2]
into
    mov    r3, r9
    add    r3, r3, r10
    ldr    r0, [r3]
which saves a register.

Attached is a contrived test case. Compiling with gcc-4.9 with -mthumb -mno-lra 
(at -O1 and higher) produces the second (better) sequence. Compiling with
gcc-4.9 or gcc-trunk with -mthumb (at -O1 and higher) produces the first
sequence. The sequences appear after the 'nop'

gcc-4.9 is 
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20141119
(release) [ARM/embedded-4_9-branch revision 218278]

trunk is:
arm-none-eabi-gcc (unknown) 5.0.0 20150217 (experimental)

Reply via email to