This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/43286] New: Missed related value optimization in cse.c
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Mar 2010 08:27:34 -0000
- Subject: [Bug rtl-optimization/43286] New: Missed related value optimization in cse.c
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
foo1:
stmfd sp!, {r4, r5, r6, lr}
ldr r4, .L2
sub r6, r0, #16 // A
mov r5, r0 // B
mov r3, r1
mov r1, r0
ldr r0, .L2+4
.LPIC0:
add r4, pc, r4
sub sp, sp, #8
mov r2, r6 //
add r0, r4, r0
bl printf(PLT)
ldr r0, [r6, #12] //
ldr r1, [r5, #-16] //
ldmib r6, {r2, r3} @ phole ldm //
str r0, [sp, #0]
ldr r0, [r5, #0] //
str r0, [sp, #4]
ldr r0, .L2+8
add r0, r4, r0
bl printf(PLT)
add sp, sp, #8
ldmfd sp!, {r4, r5, r6, pc}
According to instructions AB, r5 = r6 + 16. All following instructions
involving r5 are memory loads. The usage of r5 can be replaced by r6 with an
adjusted offset. Then instruction B can be removed.
I assumed pass cse1 should handle this optimization. But after reading the code
of function insert_with_costs I realized it can't handle arbitrary related
expression, the only form that can be processed is constant related
expressions, such as (plus SYMBOL offset).
--
Summary: Missed related value optimization in cse.c
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=43286