aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-08-03 10:23:55 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-08-03 08:23:55 +0000
commit0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4 (patch)
tree6893c12531b17830080c226b0ab4329896a5a588 /gcc/ipa-cp.c
parent563430f7f3c7d4c2358dd2acaf33258d7f0b0c57 (diff)
downloadgcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.zip
gcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.tar.gz
gcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.tar.bz2
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
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c51
1 files changed, 15 insertions, 36 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 73f9d6e..b463a62 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1758,13 +1758,12 @@ gather_context_independent_values (struct ipa_node_params *info,
}
else if (removable_params_cost
&& !ipa_is_param_used (info, i))
- *removable_params_cost
- += estimate_move_cost (TREE_TYPE (ipa_get_param (info, i)));
+ *removable_params_cost += ipa_get_param_move_cost (info, i);
}
else if (removable_params_cost
&& !ipa_is_param_used (info, i))
*removable_params_cost
- += estimate_move_cost (TREE_TYPE (ipa_get_param (info, i)));
+ += ipa_get_param_move_cost (info, i);
if (known_aggs)
{
@@ -1933,8 +1932,8 @@ estimate_local_effects (struct cgraph_node *node)
{
fprintf (dump_file, " - estimates for value ");
print_ipcp_constant_value (dump_file, val->value);
- fprintf (dump_file, " for parameter ");
- print_generic_expr (dump_file, ipa_get_param (info, i), 0);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, info, i);
fprintf (dump_file, ": time_benefit: %i, size: %i\n",
time_benefit, size);
}
@@ -1990,8 +1989,8 @@ estimate_local_effects (struct cgraph_node *node)
{
fprintf (dump_file, " - estimates for value ");
print_ipcp_constant_value (dump_file, val->value);
- fprintf (dump_file, " for parameter ");
- print_generic_expr (dump_file, ipa_get_param (info, i), 0);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, info, i);
fprintf (dump_file, "[%soffset: " HOST_WIDE_INT_PRINT_DEC
"]: time_benefit: %i, size: %i\n",
plats->aggs_by_ref ? "ref " : "",
@@ -2480,36 +2479,17 @@ gather_edges_for_value (struct ipcp_value *val, int caller_count)
Return it or NULL if for some reason it cannot be created. */
static struct ipa_replace_map *
-get_replacement_map (tree value, tree parm, int parm_num)
+get_replacement_map (struct ipa_node_params *info, tree value, int parm_num)
{
- tree req_type = TREE_TYPE (parm);
struct ipa_replace_map *replace_map;
- if (!useless_type_conversion_p (req_type, TREE_TYPE (value)))
- {
- if (fold_convertible_p (req_type, value))
- value = fold_build1 (NOP_EXPR, req_type, value);
- else if (TYPE_SIZE (req_type) == TYPE_SIZE (TREE_TYPE (value)))
- value = fold_build1 (VIEW_CONVERT_EXPR, req_type, value);
- else
- {
- if (dump_file)
- {
- fprintf (dump_file, " const ");
- print_generic_expr (dump_file, value, 0);
- fprintf (dump_file, " can't be converted to param ");
- print_generic_expr (dump_file, parm, 0);
- fprintf (dump_file, "\n");
- }
- return NULL;
- }
- }
replace_map = ggc_alloc_ipa_replace_map ();
if (dump_file)
{
- fprintf (dump_file, " replacing param ");
- print_generic_expr (dump_file, parm, 0);
+ fprintf (dump_file, " replacing ");
+ ipa_dump_param (dump_file, info, parm_num);
+
fprintf (dump_file, " with const ");
print_generic_expr (dump_file, value, 0);
fprintf (dump_file, "\n");
@@ -2697,7 +2677,7 @@ create_specialized_node (struct cgraph_node *node,
{
struct ipa_replace_map *replace_map;
- replace_map = get_replacement_map (t, ipa_get_param (info, i), i);
+ replace_map = get_replacement_map (info, t, i);
if (replace_map)
vec_safe_push (replace_trees, replace_map);
}
@@ -2781,8 +2761,8 @@ find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
{
fprintf (dump_file, " adding an extra known scalar value ");
print_ipcp_constant_value (dump_file, newval);
- fprintf (dump_file, " for parameter ");
- print_generic_expr (dump_file, ipa_get_param (info, i), 0);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, info, i);
fprintf (dump_file, "\n");
}
@@ -3352,9 +3332,8 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
{
fprintf (dump_file, " - considering value ");
print_ipcp_constant_value (dump_file, val->value);
- fprintf (dump_file, " for parameter ");
- print_generic_expr (dump_file, ipa_get_param (IPA_NODE_REF (node),
- index), 0);
+ fprintf (dump_file, " for ");
+ ipa_dump_param (dump_file, IPA_NODE_REF (node), index);
if (offset != -1)
fprintf (dump_file, ", offset: " HOST_WIDE_INT_PRINT_DEC, offset);
fprintf (dump_file, " (caller_count: %i)\n", caller_count);