2005-03-02 Richard Guenther * opts.c (decode_options): Do not fiddle with inlining parameters in case of optimizing for size. * cgraphunit.c (cgraph_check_inline_limits): If optimizing for size make sure we do not grow the unit-size by inlining. (cgraph_decide_recursive_inlining): Likewise. Index: opts.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/opts.c,v retrieving revision 1.94 diff -c -3 -p -r1.94 opts.c *** opts.c 24 Feb 2005 09:24:13 -0000 1.94 --- opts.c 2 Mar 2005 13:10:58 -0000 *************** decode_options (unsigned int argc, const *** 572,580 **** if (optimize_size) { ! /* Inlining of very small functions usually reduces total size. */ ! set_param_value ("max-inline-insns-single", 5); ! set_param_value ("max-inline-insns-auto", 5); flag_inline_functions = 1; /* We want to crossjump as much as possible. */ --- 572,579 ---- if (optimize_size) { ! /* Inlining of functions reducing size is a good idea regardless ! of them being declared inline. */ flag_inline_functions = 1; /* We want to crossjump as much as possible. */ Index: cgraphunit.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v retrieving revision 1.93.2.1 diff -c -3 -p -r1.93.2.1 cgraphunit.c *** cgraphunit.c 2 Mar 2005 10:10:30 -0000 1.93.2.1 --- cgraphunit.c 2 Mar 2005 13:10:58 -0000 *************** cgraph_check_inline_limits (struct cgrap *** 1184,1189 **** --- 1189,1201 ---- limit += limit * PARAM_VALUE (PARAM_LARGE_FUNCTION_GROWTH) / 100; newsize = cgraph_estimate_size_after_inlining (times, to, what); + if (optimize_size + && newsize > to->global.insns) + { + if (reason) + *reason = N_("optimizing for size"); + return false; + } if (newsize > PARAM_VALUE (PARAM_LARGE_FUNCTION_INSNS) && newsize > limit) { *************** cgraph_decide_recursive_inlining (struct *** 1279,1284 **** --- 1291,1297 ---- struct cgraph_node *master_clone; int depth = 0; int n = 0; + int newsize; if (DECL_DECLARED_INLINE_P (node->decl)) { *************** cgraph_decide_recursive_inlining (struct *** 1287,1294 **** } /* Make sure that function is small enough to be considered for inlining. */ ! if (!max_depth ! || cgraph_estimate_size_after_inlining (1, node, node) >= limit) return; lookup_recursive_calls (node, node, &first_call, &last_call); if (!first_call) --- 1300,1309 ---- } /* Make sure that function is small enough to be considered for inlining. */ ! newsize = cgraph_estimate_size_after_inlining (1, node, node); ! if (! max_depth ! || newsize >= limit ! || (optimize_size && newsize > node->global.insns)) return; lookup_recursive_calls (node, node, &first_call, &last_call); if (!first_call)