From 0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 3 Aug 2013 10:23:55 +0200 Subject: ipa-cp.c (gather_context_independent_values): Use ipa_get_param_move_cost. * ipa-cp.c (gather_context_independent_values): Use ipa_get_param_move_cost. (get_replacement_map): Remove PARAM; move parameter folding into tree-inline.c (create_specialized_node): Update. * ipa-prop.c (ipa_populate_param_decls): Do not look for origins; assert that we have gimple body; update move_cost. (count_formal_params): Assert that we have gimple body. (ipa_dump_param): New function. (ipa_alloc_node_params): Break out from ... (ipa_initialize_node_params): ... here. (ipa_get_vector_of_formal_parms): ICE when used in WPA. (ipa_write_node_info): Stream move costs. (ipa_read_node_info): Read move costs. (ipa_update_after_lto_read): Do not recompute node params. * ipa-prop.h (ipa_param_descriptor): Add move_cost. (ipa_get_param): Check we are not in WPA. (ipa_get_param_move_cost): New. * tree-inline.c (tree_function_versioning): Fold replacement as needed. * ipa-inline-analysis.c (inline_node_duplication_hook): Expect only parm numbers to be present. * gcc.dg/ipa/ipa-1.c: Update. * gcc.dg/ipa/ipa-2.c: Update. * gcc.dg/ipa/ipa-3.c: Update. * gcc.dg/ipa/ipa-4.c: Update. * gcc.dg/ipa/ipa-5.c: Update. * gcc.dg/ipa/ipa-7.c: Update. * gcc.dg/ipa/ipa-8.c: Update. * gcc.dg/ipa/ipcp-1.c: Update. * gcc.dg/ipa/ipcp-2.c: Update. From-SVN: r201462 --- gcc/ipa-prop.c | 59 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 19 deletions(-) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index bf9e903..ef4dff7 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -130,16 +130,14 @@ ipa_populate_param_decls (struct cgraph_node *node, tree parm; int param_num; - /* We do not copy DECL_ARGUMENTS to virtual clones. */ - while (node->clone_of) - node = node->clone_of; - fndecl = node->symbol.decl; + gcc_assert (gimple_has_body_p (fndecl)); fnargs = DECL_ARGUMENTS (fndecl); param_num = 0; for (parm = fnargs; parm; parm = DECL_CHAIN (parm)) { descriptors[param_num].decl = parm; + descriptors[param_num].move_cost = estimate_move_cost (TREE_TYPE (parm)); param_num++; } } @@ -151,6 +149,7 @@ count_formal_params (tree fndecl) { tree parm; int count = 0; + gcc_assert (gimple_has_body_p (fndecl)); for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) count++; @@ -158,6 +157,33 @@ count_formal_params (tree fndecl) return count; } +/* Return the declaration of Ith formal parameter of the function corresponding + to INFO. Note there is no setter function as this array is built just once + using ipa_initialize_node_params. */ + +void +ipa_dump_param (FILE *file, struct ipa_node_params *info, int i) +{ + fprintf (file, "param #%i", i); + if (info->descriptors[i].decl) + { + fprintf (file, " "); + print_generic_expr (file, info->descriptors[i].decl, 0); + } +} + +/* Initialize the ipa_node_params structure associated with NODE + to hold PARAM_COUNT parameters. */ + +void +ipa_alloc_node_params (struct cgraph_node *node, int param_count) +{ + struct ipa_node_params *info = IPA_NODE_REF (node); + + if (!info->descriptors.exists () && param_count) + info->descriptors.safe_grow_cleared (param_count); +} + /* Initialize the ipa_node_params structure associated with NODE by counting the function parameters, creating the descriptors and populating their param_decls. */ @@ -169,15 +195,8 @@ ipa_initialize_node_params (struct cgraph_node *node) if (!info->descriptors.exists ()) { - int param_count; - gcc_assert (!node->clone_of); - - param_count = count_formal_params (node->symbol.decl); - if (param_count) - { - info->descriptors.safe_grow_cleared (param_count); - ipa_populate_param_decls (node, info->descriptors); - } + ipa_alloc_node_params (node, count_formal_params (node->symbol.decl)); + ipa_populate_param_decls (node, info->descriptors); } } @@ -3064,6 +3083,7 @@ ipa_get_vector_of_formal_parms (tree fndecl) int count; tree parm; + gcc_assert (!flag_wpa); count = count_formal_params (fndecl); args.create (count); for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) @@ -3856,6 +3876,9 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node) node_ref = lto_symtab_encoder_encode (encoder, (symtab_node) node); streamer_write_uhwi (ob, node_ref); + streamer_write_uhwi (ob, ipa_get_param_count (info)); + for (j = 0; j < ipa_get_param_count (info); j++) + streamer_write_uhwi (ob, ipa_get_param_move_cost (info, j)); bp = bitpack_create (ob->main_stream); gcc_assert (info->uses_analysis_done || ipa_get_param_count (info) == 0); @@ -3896,8 +3919,11 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node, struct cgraph_edge *e; struct bitpack_d bp; - ipa_initialize_node_params (node); + ipa_alloc_node_params (node, streamer_read_uhwi (ib)); + for (k = 0; k < ipa_get_param_count (info); k++) + info->descriptors[k].move_cost = streamer_read_uhwi (ib); + bp = streamer_read_bitpack (ib); if (ipa_get_param_count (info) != 0) info->uses_analysis_done = true; @@ -4049,13 +4075,8 @@ ipa_prop_read_jump_functions (void) void ipa_update_after_lto_read (void) { - struct cgraph_node *node; - ipa_check_create_node_params (); ipa_check_create_edge_args (); - - FOR_EACH_DEFINED_FUNCTION (node) - ipa_initialize_node_params (node); } void -- cgit v1.1