This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34790] Missed optimisation on avr - no sibling call optimisation
- From: "david at westcontrol dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2008 08:34:34 -0000
- Subject: [Bug c/34790] Missed optimisation on avr - no sibling call optimisation
- References: <bug-34790-15632@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from david at westcontrol dot com 2008-01-15 08:34 -------
(Sorry - I committed the bug before entering the description!)
Sibling calls are not optimised on avrgcc, even with -foptimize-sibling-calls
enabled (such as for -Os):
extern void foo(void);
void bar(void) {
foo();
}
40 bar:
41 /* prologue: frame size=0 */
42 /* prologue end (size=0) */
43 0000 0E94 0000 call foo ;
44 /* epilogue: frame size=0 */
45 0004 0895 ret
46 /* epilogue end (size=1) */
47 /* function bar size 3 (2) */
Optimising the "call foo; ret" sequence to "jmp foo" would reduce the code size
by 1 word, the stack usage by 2 bytes (on most avrs), and save 5 cycles.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34790