From 000020907344fccdd11036944874d80d137557df Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Tue, 30 Dec 2008 13:35:00 +0000 Subject: [PATCH] re PR middle-end/38584 (Inline heuristics run even at -O0) PR middle-end/38584 * ipa-inline.c (compute_inline_parameters): When not optimizing, don't compute the inline parameters, just set them to 0 instead. From-SVN: r142963 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-inline.c | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c3789a2a82..87d22b44efa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-12-30 Steven Bosscher + + PR middle-end/38584 + * ipa-inline.c (compute_inline_parameters): When not optimizing, + don't compute the inline parameters, just set them to 0 instead. + 2008-12-30 Paolo Bonzini PR tree-optimization/38572 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 35ec9a60f86..0656d798bc2 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1592,18 +1592,30 @@ struct simple_ipa_opt_pass pass_ipa_early_inline = unsigned int compute_inline_parameters (struct cgraph_node *node) { + HOST_WIDE_INT self_stack_size; + gcc_assert (!node->global.inlined_to); - inline_summary (node)->estimated_self_stack_size - = estimated_stack_frame_size (); - node->global.estimated_stack_size - = inline_summary (node)->estimated_self_stack_size; + + /* Estimate the stack size for the function. But not at -O0 + because estimated_stack_frame_size is a quadratic problem. */ + self_stack_size = optimize ? estimated_stack_frame_size () : 0; + inline_summary (node)->estimated_self_stack_size = self_stack_size; + node->global.estimated_stack_size = self_stack_size; node->global.stack_frame_offset = 0; + + /* Can this function be inlined at all? */ node->local.inlinable = tree_inlinable_function_p (current_function_decl); + + /* Estimate the number of instructions for this function. + ??? At -O0 we don't use this information except for the dumps, and + even then only for always_inline functions. But disabling this + causes ICEs in the inline heuristics... */ inline_summary (node)->self_insns = estimate_num_insns_fn (current_function_decl, &eni_inlining_weights); if (node->local.inlinable && !node->local.disregard_inline_limits) node->local.disregard_inline_limits = DECL_DISREGARD_INLINE_LIMITS (current_function_decl); + /* Inlining characteristics are maintained by the cgraph_mark_inline. */ node->global.insns = inline_summary (node)->self_insns; return 0;