Commit 30925d94 by Alexandre Oliva Committed by Alexandre Oliva

re PR debug/47106 (-fcompare-debug failure (length) with -fpartial-inlining…

re PR debug/47106 (-fcompare-debug failure (length) with  -fpartial-inlining -flto -fconserve-stack)

PR debug/47106
PR debug/47402
* tree-inline.h (estimated_stack_frame_size): Take cgraph node
rather than decl.
* cfgexpand.c (estimated_stack_frame_size): Likewise.
* ipa-inline.c (compute_inline_parameters): Adjust.

From-SVN: r170187
parent 1b9a784a
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
PR debug/47106 PR debug/47106
PR debug/47402 PR debug/47402
* tree-inline.h (estimated_stack_frame_size): Take cgraph node
rather than decl.
* cfgexpand.c (estimated_stack_frame_size): Likewise.
* ipa-inline.c (compute_inline_parameters): Adjust.
2011-02-15 Alexandre Oliva <aoliva@redhat.com>
PR debug/47106
PR debug/47402
* tree-flow.h (FOR_EACH_REFERENCED_VAR): Add FN argument. * tree-flow.h (FOR_EACH_REFERENCED_VAR): Add FN argument.
Adjust all users. Pass FN to... Adjust all users. Pass FN to...
* tree-flow-inline.h (first_referenced_var): ... this. Add * tree-flow-inline.h (first_referenced_var): ... this. Add
......
...@@ -1366,24 +1366,25 @@ fini_vars_expansion (void) ...@@ -1366,24 +1366,25 @@ fini_vars_expansion (void)
stack_vars_alloc = stack_vars_num = 0; stack_vars_alloc = stack_vars_num = 0;
} }
/* Make a fair guess for the size of the stack frame of the decl /* Make a fair guess for the size of the stack frame of the function
passed. This doesn't have to be exact, the result is only used in NODE. This doesn't have to be exact, the result is only used in
in the inline heuristics. So we don't want to run the full stack the inline heuristics. So we don't want to run the full stack var
var packing algorithm (which is quadratic in the number of stack packing algorithm (which is quadratic in the number of stack vars).
vars). Instead, we calculate the total size of all stack vars. Instead, we calculate the total size of all stack vars. This turns
This turns out to be a pretty fair estimate -- packing of stack out to be a pretty fair estimate -- packing of stack vars doesn't
vars doesn't happen very often. */ happen very often. */
HOST_WIDE_INT HOST_WIDE_INT
estimated_stack_frame_size (tree decl) estimated_stack_frame_size (struct cgraph_node *node)
{ {
HOST_WIDE_INT size = 0; HOST_WIDE_INT size = 0;
size_t i; size_t i;
tree var, outer_block = DECL_INITIAL (current_function_decl); tree var, outer_block = DECL_INITIAL (current_function_decl);
unsigned ix; unsigned ix;
tree old_cur_fun_decl = current_function_decl; tree old_cur_fun_decl = current_function_decl;
current_function_decl = decl;
push_cfun (DECL_STRUCT_FUNCTION (decl)); current_function_decl = node->decl;
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
init_vars_expansion (); init_vars_expansion ();
......
...@@ -1982,9 +1982,8 @@ compute_inline_parameters (struct cgraph_node *node) ...@@ -1982,9 +1982,8 @@ compute_inline_parameters (struct cgraph_node *node)
gcc_assert (!node->global.inlined_to); gcc_assert (!node->global.inlined_to);
/* Estimate the stack size for the function. But not at -O0 /* Estimate the stack size for the function if we're optimizing. */
because estimated_stack_frame_size is a quadratic problem. */ self_stack_size = optimize ? estimated_stack_frame_size (node) : 0;
self_stack_size = optimize ? estimated_stack_frame_size (node->decl) : 0;
inline_summary (node)->estimated_self_stack_size = self_stack_size; inline_summary (node)->estimated_self_stack_size = self_stack_size;
node->global.estimated_stack_size = self_stack_size; node->global.estimated_stack_size = self_stack_size;
node->global.stack_frame_offset = 0; node->global.stack_frame_offset = 0;
......
...@@ -188,6 +188,6 @@ extern tree remap_decl (tree decl, copy_body_data *id); ...@@ -188,6 +188,6 @@ extern tree remap_decl (tree decl, copy_body_data *id);
extern tree remap_type (tree type, copy_body_data *id); extern tree remap_type (tree type, copy_body_data *id);
extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq); extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq);
extern HOST_WIDE_INT estimated_stack_frame_size (tree); extern HOST_WIDE_INT estimated_stack_frame_size (struct cgraph_node *);
#endif /* GCC_TREE_INLINE_H */ #endif /* GCC_TREE_INLINE_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment