This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/34790] Missed optimisation on avr - no sibling call optimisation



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]