This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/42226] New: [missed optimization] inefficient byte access when -Os is specified
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Nov 2009 08:55:52 -0000
- Subject: [Bug rtl-optimization/42226] New: [missed optimization] inefficient byte access when -Os is specified
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile the attached test case with options -Os -mthumb, gcc generates:
add r1, r1, #40
mov r3, r0
ldrb r2, [r1]
add r3, r3, #40
strb r2, [r3]
@ sp needed for prologue
bx lr
When change the options to -O2 -mthumb, gcc generates:
mov r3, #40
ldrb r2, [r1, r3]
strb r2, [r0, r3]
@ sp needed for prologue
bx lr
It is both smaller and faster.
Compare the dumped IL with different options, all TREE expressions are
identical. The first difference occurs after rtl expanding.
--
Summary: [missed optimization] inefficient byte access when -Os
is specified
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: carrot at google dot com
GCC build triplet: i686-linux
GCC host triplet: i686-linux
GCC target triplet: arm-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42226