This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Disable sibcall optimization when -Os
- From: tm_gccmail at mail dot kloo dot net
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Apr 2003 19:32:43 -0700 (PDT)
- Subject: Disable sibcall optimization when -Os
On my testcases for the SH4, I see significant code expansion (~8%) when
sibcall optimization is enabled due to:
1) A bunch of register pushes (typically 8) generated (16 bytes or so)
2) A BARRIER generated afterwards which forces 32-byte alignment
(average 16 bytes)
So every time it's invoked, it adds about 32 bytes to the code size.
Therefore, I propose it be disabled when -Os is specified.
2003-04-11 Toshiyasu Morita <toshiyasu dot morita at renesas dot com>
* calls.c (expand_call): Disable sibcall optimization if
optimizing for size.
*** calls.c.bak Fri Apr 11 19:01:45 2003
--- calls.c Fri Apr 11 19:15:30 2003
*************** expand_call (exp, target, ignore)
*** 2510,2515 ****
--- 2510,2518 ----
#else
1
#endif
+ /* Do not perform sibling call optimization when optimizing for size
+ because the code size expansion can be significant. */
+ || optimize_size
|| !try_tail_call
/* Doing sibling call optimization needs some work, since
structure_value_addr can be allocated on the stack.