This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function
- From: "tm at kloo dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Sep 2003 22:15:57 -0000
- Subject: [Bug optimization/12305] New: processor return register saved/restore unnecessarily in leaf function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12305
Summary: processor return register saved/restore unnecessarily in
leaf function
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tm at kloo dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-linux
GCC host triplet: i386-linux
GCC target triplet: sh-elf
When this function is compiled:
int a, b; int foo(void) { return a + b; }
using -O2 -m4 -fPIC -S, the following code is created:
_foo:
mov.l r12,@-r15
mova .L3,r0
mov.l .L3,r12
mov.l r14,@-r15
add r0,r12
mov.l .L4,r0
sts.l pr,@-r15 <- PR saved unnecessarily
mov.l @(r0,r12),r1
mov r12,r0
mov r15,r14
mov.l @r1,r2
mov.l .L5,r1
mov.l @(r0,r1),r1
mov.l @r1,r1
add r1,r2
mov r2,r0
mov r14,r15
lds.l @r15+,pr <- PR restored unnecessarily
mov.l @r15+,r14
rts
mov.l @r15+,r12