public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/52025] New: caller-saves triggers a frame without need
@ 2012-01-27 23:22 gjl at gcc dot gnu.org
2012-01-27 23:23 ` [Bug rtl-optimization/52025] " gjl at gcc dot gnu.org
2012-01-27 23:29 ` gjl at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-01-27 23:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52025
Bug #: 52025
Summary: caller-saves triggers a frame without need
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization, ra
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gjl@gcc.gnu.org
CC: eric.weddington@atmel.com
Target: avr
The following code triggers a frame even though there is just one local
variable and there are plenty of call-saved registers.
Apart from the optimization regression, this PR might be related to PR50925.
Notice that the code is a minimized test case from the top-level code of a
real-world embedded application. Therefore, the code runs in an infinite loop.
extern void putch (char);
extern char getch (void);
extern void verify (void);
void main_loop (void)
{
unsigned char c;
for (;;)
{
getch();
c = getch();
verify();
putch (c);
}
}
The generated code with -Os -dp -save-temps is
main_loop:
push r29 ; 36 *pushhi/1 [length = 2]
push r28
push __tmp_reg__ ; 40 *addhi3_sp_R_pc2 [length = 1]
in r28,__SP_L__ ; 41 *movhi_sp/2 [length = 2]
in r29,__SP_H__
.L2:
rcall getch ; 7 call_value_insn/3 [length = 1]
rcall getch ; 9 call_value_insn/3 [length = 1]
std Y+1,r24 ; 34 *movqi/3 [length = 1]
rcall verify ; 12 call_insn/3 [length = 1]
ldd r24,Y+1 ; 35 *movqi/4 [length = 1]
rcall putch ; 15 call_insn/3 [length = 1]
rjmp .L2 ; 44 jump [length = 1]
The insns triggering the frame are 34 and 35.
-fno-caller-saves resolves the issue and the code then then uses r17 to backup
the value from getch.
main_loop:
push r17 ; 30 *pushqi/1 [length = 1]
.L2:
rcall getch ; 7 call_value_insn/3 [length = 1]
rcall getch ; 9 call_value_insn/3 [length = 1]
mov r17,r24 ; 10 *movqi/1 [length = 1]
rcall verify ; 12 call_insn/3 [length = 1]
mov r24,r17 ; 14 *movqi/1 [length = 1]
rcall putch ; 15 call_insn/3 [length = 1]
rjmp .L2 ; 33 jump [length = 1]
Target: avr
Configured with: ../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/home/georg/install/gcc-4.7 --enable-languages=c,c++ --disable-nls
--disable-shared --disable-lto --disable-checking --disable-libquadmath
--with-dwarf2
Thread model: single
gcc version 4.7.0 20120102 (experimental) (GCC)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/52025] caller-saves triggers a frame without need
2012-01-27 23:22 [Bug rtl-optimization/52025] New: caller-saves triggers a frame without need gjl at gcc dot gnu.org
@ 2012-01-27 23:23 ` gjl at gcc dot gnu.org
2012-01-27 23:29 ` gjl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-01-27 23:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52025
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-27
Ever Confirmed|0 |1
Known to fail| |4.5.2, 4.6.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/52025] caller-saves triggers a frame without need
2012-01-27 23:22 [Bug rtl-optimization/52025] New: caller-saves triggers a frame without need gjl at gcc dot gnu.org
2012-01-27 23:23 ` [Bug rtl-optimization/52025] " gjl at gcc dot gnu.org
@ 2012-01-27 23:29 ` gjl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-01-27 23:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52025
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2012-01-27 23:08:34 UTC ---
Created attachment 26485
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26485
main-loop.c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-27 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27 23:22 [Bug rtl-optimization/52025] New: caller-saves triggers a frame without need gjl at gcc dot gnu.org
2012-01-27 23:23 ` [Bug rtl-optimization/52025] " gjl at gcc dot gnu.org
2012-01-27 23:29 ` gjl 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).