aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-09-03 20:16:26 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-09-03 18:16:26 +0000
commit39ecc018798bc85d22bfc3c3155986ab5b35f5ac (patch)
tree2ec6cd14c2fd416d7473c8942ba129ded5f4824b /gcc/tree-inline.c
parentcafea0e43647f764861b625232460c584fe11086 (diff)
downloadgcc-39ecc018798bc85d22bfc3c3155986ab5b35f5ac.zip
gcc-39ecc018798bc85d22bfc3c3155986ab5b35f5ac.tar.gz
gcc-39ecc018798bc85d22bfc3c3155986ab5b35f5ac.tar.bz2
re PR tree-optimization/37315 (gcc.c-torture/execute/931018-1.c int-compare.c ieee/inf-2.c mzero6.c)
PR tree-optimization/37315 * cgraph.c (cgraph_create_edge): Use gimple_has_body_p. * cgraphunit.c (verify_cgraph_node): drop gimple_body check. (cgraph_analyze_functions): Use node->analyzed (cgraph_mark_functions_to_output): Likewise. (cgraph_expand_function): All functions can be released after expanding. (cgraph_optimize): Use gimple_has_body_p. * ipa-inline.c (cgraph_clone_inlined_nodes): Use analyzed flag. (cgraph_decide_inlining_incrementally): Likewise. (inline_transform): Inline transform. * tree-inline.c (initialize_cfun): Do now shallow copy structure; copy fields needed. (inlinable_function_p): Drop gimple_body check. (expand_call_inline): Use gimple_has_body_p. * gimple.c (gimple_has_body_p): New. * gimple.h (gimple_has_body_p): Add prototype. * tree-cfg.c (execute_build_cfg): Remove gimple_body. (dump_function_to_file): Use gimple_has_body_p check. From-SVN: r139945
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 3b77c0e..8b603f0 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1692,8 +1692,6 @@ static void
initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count,
int frequency)
{
- struct function *new_cfun
- = (struct function *) ggc_alloc_cleared (sizeof (struct function));
struct function *src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl);
gcov_type count_scale, frequency_scale;
@@ -1712,14 +1710,40 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count,
/* Register specific tree functions. */
gimple_register_cfg_hooks ();
- *new_cfun = *DECL_STRUCT_FUNCTION (callee_fndecl);
- new_cfun->funcdef_no = get_next_funcdef_no ();
- VALUE_HISTOGRAMS (new_cfun) = NULL;
- new_cfun->local_decls = NULL;
- new_cfun->cfg = NULL;
- new_cfun->decl = new_fndecl /*= copy_node (callee_fndecl)*/;
- DECL_STRUCT_FUNCTION (new_fndecl) = new_cfun;
- push_cfun (new_cfun);
+
+ /* Get clean struct function. */
+ push_struct_function (new_fndecl);
+
+ /* We will rebuild these, so just sanity check that they are empty. */
+ gcc_assert (VALUE_HISTOGRAMS (cfun) == NULL);
+ gcc_assert (cfun->local_decls == NULL);
+ gcc_assert (cfun->cfg == NULL);
+ gcc_assert (cfun->decl == new_fndecl);
+
+ /* No need to copy; this is initialized later in compilation. */
+ gcc_assert (!src_cfun->calls_setjmp);
+ gcc_assert (!src_cfun->calls_alloca);
+
+ /* Copy items we preserve during clonning. */
+ cfun->static_chain_decl = src_cfun->static_chain_decl;
+ cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area;
+ cfun->function_end_locus = src_cfun->function_end_locus;
+ cfun->curr_properties = src_cfun->curr_properties;
+ cfun->last_verified = src_cfun->last_verified;
+ if (src_cfun->ipa_transforms_to_apply)
+ cfun->ipa_transforms_to_apply = VEC_copy (ipa_opt_pass, heap,
+ src_cfun->ipa_transforms_to_apply);
+ cfun->va_list_gpr_size = src_cfun->va_list_gpr_size;
+ cfun->va_list_fpr_size = src_cfun->va_list_fpr_size;
+ cfun->function_frequency = src_cfun->function_frequency;
+ cfun->has_nonlocal_label = src_cfun->has_nonlocal_label;
+ cfun->stdarg = src_cfun->stdarg;
+ cfun->dont_save_pending_sizes_p = src_cfun->dont_save_pending_sizes_p;
+ cfun->after_inlining = src_cfun->after_inlining;
+ cfun->returns_struct = src_cfun->returns_struct;
+ cfun->returns_pcc_struct = src_cfun->returns_pcc_struct;
+ cfun->after_tree_profile = src_cfun->after_tree_profile;
+
init_empty_tree_cfg ();
ENTRY_BLOCK_PTR->count =
@@ -2581,12 +2605,6 @@ inlinable_function_p (tree fn)
inlinable = false;
}
- /* If we don't have the function body available, we can't inline it.
- However, this should not be recorded since we also get here for
- forward declared inline functions. Therefore, return at once. */
- if (!gimple_body (fn))
- return false;
-
else if (inline_forbidden_p (fn))
{
/* See if we should warn about uninlinable functions. Previously,
@@ -3089,7 +3107,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
gimple_body. */
if (!DECL_INITIAL (fn)
&& DECL_ABSTRACT_ORIGIN (fn)
- && gimple_body (DECL_ABSTRACT_ORIGIN (fn)))
+ && gimple_has_body_p (DECL_ABSTRACT_ORIGIN (fn)))
fn = DECL_ABSTRACT_ORIGIN (fn);
/* Objective C and fortran still calls tree_rest_of_compilation directly.