Commit 1d405d7b by Jan Hubicka Committed by Jan Hubicka

Revert the following patch until testsuite fallout is fixed:

	* cgraph.c (dump_cgraph_node): Dump size/time/benefit.
	* cgraph.h (struct inline_summary): New filed self_wize,
	size_inlining_benefit, self_time and time_inlining_benefit.
	(struct cgraph_global_info): Replace insns by time ans size fields.
	* ipa-cp (ipcp_cloning_candidate_p): Base estimate on size
	(ipcp_estimate_growth, ipcp_insert_stage): Likewise.
	(ipcp_update_callgraph): Do not touch function bodies.
	* ipa-inline.c: Include except.h
	MAX_TIME: New constant.
	(overall_insns): Remove
	(overall_size, max_benefit): New static variables.
	(cgraph_estimate_time_after_inlining): New function.
	(cgraph_estimate_size_after_inlining): Rewrite using benefits.
	(cgraph_clone_inlined_nodes): Update size.
	(cgraph_mark_inline_edge): Update size.
	(cgraph_estimate_growth): Use size info.
	(cgraph_check_inline_limits): Check size.
	(cgraph_default_inline_p): Likewise.
	(cgraph_edge_badness): Compute badness based on benefit and size cost.
	(cgraph_decide_recursive_inlining): Check size.
	(cgraph_decide_inlining_of_small_function): Update size; dump sizes and times.
	(cgraph_decide_inlining): Likewise.
	(cgraph_decide_inlining_incrementally): Likewise; honor PARAM_EARLY_INLINING_INSNS.
	(likely_eliminated_by_inlining_p): New predicate.
	(estimate_function_body_sizes): New function.
	(compute_inline_parameters): Use it.
	* except.c (must_not_throw_labels): New function.
	* except.h (must_not_throw_labels): Declare.
	* tree-inline.c (init_inline_once): Kill inlining_weigths
	* tree-ssa-structalias.c: Avoid uninitialized warning.
	* params.def (PARAM_MAX_INLINE_INSNS_SINGLE): Reduce to 300.
	(PARAM_MAX_INLINE_INSNS_AUTO): Reduce to 60.
	(PARAM_INLINE_CALL_COST): Remove.
	(PARAM_EARLY_INLINING_INSNS): New.

From-SVN: r147575
parent 7ffa47ca
2009-05-15 Jan Hubicka <jh@suse.cz>
Revert the following patch until testsuite fallout is fixed:
* cgraph.c (dump_cgraph_node): Dump size/time/benefit.
* cgraph.h (struct inline_summary): New filed self_wize,
size_inlining_benefit, self_time and time_inlining_benefit.
(struct cgraph_global_info): Replace insns by time ans size fields.
* ipa-cp (ipcp_cloning_candidate_p): Base estimate on size
(ipcp_estimate_growth, ipcp_insert_stage): Likewise.
(ipcp_update_callgraph): Do not touch function bodies.
* ipa-inline.c: Include except.h
MAX_TIME: New constant.
(overall_insns): Remove
(overall_size, max_benefit): New static variables.
(cgraph_estimate_time_after_inlining): New function.
(cgraph_estimate_size_after_inlining): Rewrite using benefits.
(cgraph_clone_inlined_nodes): Update size.
(cgraph_mark_inline_edge): Update size.
(cgraph_estimate_growth): Use size info.
(cgraph_check_inline_limits): Check size.
(cgraph_default_inline_p): Likewise.
(cgraph_edge_badness): Compute badness based on benefit and size cost.
(cgraph_decide_recursive_inlining): Check size.
(cgraph_decide_inlining_of_small_function): Update size; dump sizes and times.
(cgraph_decide_inlining): Likewise.
(cgraph_decide_inlining_incrementally): Likewise; honor PARAM_EARLY_INLINING_INSNS.
(likely_eliminated_by_inlining_p): New predicate.
(estimate_function_body_sizes): New function.
(compute_inline_parameters): Use it.
* except.c (must_not_throw_labels): New function.
* except.h (must_not_throw_labels): Declare.
* tree-inline.c (init_inline_once): Kill inlining_weigths
* tree-ssa-structalias.c: Avoid uninitialized warning.
* params.def (PARAM_MAX_INLINE_INSNS_SINGLE): Reduce to 300.
(PARAM_MAX_INLINE_INSNS_AUTO): Reduce to 60.
(PARAM_INLINE_CALL_COST): Remove.
(PARAM_EARLY_INLINING_INSNS): New.
2009-05-15 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (eliminate): Use TODO_update_ssa_only_virtuals,
......
......@@ -1393,18 +1393,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
if (node->count)
fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x",
(HOST_WIDEST_INT)node->count);
if (node->local.inline_summary.self_time)
fprintf (f, " %i time, %i benefit", node->local.inline_summary.self_time,
node->local.inline_summary.time_inlining_benefit);
if (node->global.time && node->global.time
!= node->local.inline_summary.self_time)
fprintf (f, " (%i after inlining)", node->global.time);
if (node->local.inline_summary.self_size)
fprintf (f, " %i size, %i benefit", node->local.inline_summary.self_size,
node->local.inline_summary.size_inlining_benefit);
if (node->global.size && node->global.size
!= node->local.inline_summary.self_size)
fprintf (f, " (%i after inlining)", node->global.size);
if (node->local.inline_summary.self_insns)
fprintf (f, " %i insns", node->local.inline_summary.self_insns);
if (node->global.insns && node->global.insns
!= node->local.inline_summary.self_insns)
fprintf (f, " (%i after inlining)", node->global.insns);
if (node->local.inline_summary.estimated_self_stack_size)
fprintf (f, " %i bytes stack usage", (int)node->local.inline_summary.estimated_self_stack_size);
if (node->global.estimated_stack_size != node->local.inline_summary.estimated_self_stack_size)
......
......@@ -55,14 +55,8 @@ struct GTY(()) inline_summary
/* Estimated stack frame consumption by the function. */
HOST_WIDE_INT estimated_self_stack_size;
/* Size of the function body. */
int self_size;
/* How many instructions are likely going to disappear after inlining. */
int size_inlining_benefit;
/* Estimated time spent executing the function body. */
int self_time;
/* How much time is going to be saved by inlining. */
int time_inlining_benefit;
/* Size of the function before inlining. */
int self_insns;
};
/* Information about the function collected locally.
......@@ -114,8 +108,7 @@ struct GTY(()) cgraph_global_info {
struct cgraph_node *inlined_to;
/* Estimated size of the function after inlining. */
int time;
int size;
int insns;
/* Estimated growth after inlining. INT_MIN if not computed. */
int estimated_growth;
......
......@@ -1039,43 +1039,6 @@ get_next_region_sharing_label (int region)
return r->next_region_sharing_label->region_number;
}
/* Return bitmap of all labels that are handlers of must not throw regions. */
bitmap
must_not_throw_labels (void)
{
struct eh_region *i;
bitmap labels = BITMAP_ALLOC (NULL);
i = cfun->eh->region_tree;
if (! i)
return labels;
while (1)
{
if (i->type == ERT_MUST_NOT_THROW && i->tree_label
&& LABEL_DECL_UID (i->tree_label) >= 0)
bitmap_set_bit (labels, LABEL_DECL_UID (i->tree_label));
/* If there are sub-regions, process them. */
if (i->inner)
i = i->inner;
/* If there are peers, process them. */
else if (i->next_peer)
i = i->next_peer;
/* Otherwise, step back up the tree to the next peer. */
else
{
do {
i = i->outer;
if (i == NULL)
return labels;
} while (i->next_peer == NULL);
i = i->next_peer;
}
}
}
/* Set up EH labels for RTL. */
void
......
......@@ -274,6 +274,5 @@ extern void set_eh_throw_stmt_table (struct function *, struct htab *);
extern void remove_unreachable_regions (sbitmap, sbitmap);
extern VEC(int,heap) * label_to_region_map (void);
extern int num_eh_regions (void);
extern bitmap must_not_throw_labels (void);
extern struct eh_region *redirect_eh_edge_to_label (struct edge_def *, tree, bool, bool, int);
extern int get_next_region_sharing_label (int);
......@@ -396,7 +396,7 @@ ipcp_cloning_candidate_p (struct cgraph_node *node)
cgraph_node_name (node));
return false;
}
if (node->local.inline_summary.self_size < n_calls)
if (node->local.inline_summary.self_insns < n_calls)
{
if (dump_file)
fprintf (dump_file, "Considering %s for cloning; code would shrink.\n",
......@@ -837,7 +837,10 @@ ipcp_update_callgraph (void)
{
next = cs->next_caller;
if (!ipcp_node_is_clone (cs->caller) && ipcp_need_redirect_p (cs))
cgraph_redirect_edge_callee (cs, orig_node);
{
cgraph_redirect_edge_callee (cs, orig_node);
gimple_call_set_fndecl (cs->call_stmt, orig_node->decl);
}
}
}
}
......@@ -913,7 +916,7 @@ ipcp_estimate_growth (struct cgraph_node *node)
call site. Precise cost is dificult to get, as our size metric counts
constants and moves as free. Generally we are looking for cases that
small function is called very many times. */
growth = node->local.inline_summary.self_size
growth = node->local.inline_summary.self_insns
- removable_args * redirectable_node_callers;
if (growth < 0)
return 0;
......@@ -953,7 +956,7 @@ ipcp_estimate_cloning_cost (struct cgraph_node *node)
cost /= freq_sum * 1000 / REG_BR_PROB_BASE + 1;
if (dump_file)
fprintf (dump_file, "Cost of versioning %s is %i, (size: %i, freq: %i)\n",
cgraph_node_name (node), cost, node->local.inline_summary.self_size,
cgraph_node_name (node), cost, node->local.inline_summary.self_insns,
freq_sum);
return cost + 1;
}
......@@ -1009,7 +1012,7 @@ ipcp_insert_stage (void)
{
if (node->count > max_count)
max_count = node->count;
overall_size += node->local.inline_summary.self_size;
overall_size += node->local.inline_summary.self_insns;
}
max_new_size = overall_size;
......
......@@ -100,7 +100,7 @@ DEFPARAM (PARAM_PREDICTABLE_BRANCH_OUTCOME,
DEFPARAM (PARAM_MAX_INLINE_INSNS_SINGLE,
"max-inline-insns-single",
"The maximum number of instructions in a single function eligible for inlining",
300, 0, 0)
450, 0, 0)
/* The single function inlining limit for functions that are
inlined by virtue of -finline-functions (-O3).
......@@ -112,7 +112,7 @@ DEFPARAM (PARAM_MAX_INLINE_INSNS_SINGLE,
DEFPARAM (PARAM_MAX_INLINE_INSNS_AUTO,
"max-inline-insns-auto",
"The maximum number of instructions when automatically inlining",
60, 0, 0)
90, 0, 0)
DEFPARAM (PARAM_MAX_INLINE_INSNS_RECURSIVE,
"max-inline-insns-recursive",
......@@ -204,9 +204,9 @@ DEFPARAM(PARAM_IPCP_UNIT_GROWTH,
"ipcp-unit-growth",
"how much can given compilation unit grow because of the interprocedural constant propagation (in percent)",
10, 0, 0)
DEFPARAM(PARAM_EARLY_INLINING_INSNS,
"early-inlining-insns",
"maximal estimated growth of function body caused by early inlining of single call",
DEFPARAM(PARAM_INLINE_CALL_COST,
"inline-call-cost",
"expense of call operation relative to ordinary arithmetic operations",
12, 0, 0)
DEFPARAM(PARAM_LARGE_STACK_FRAME,
"large-stack-frame",
......
......@@ -3156,6 +3156,12 @@ estimate_num_insns_fn (tree fndecl, eni_weights *weights)
void
init_inline_once (void)
{
eni_inlining_weights.call_cost = PARAM_VALUE (PARAM_INLINE_CALL_COST);
eni_inlining_weights.target_builtin_call_cost = 1;
eni_inlining_weights.div_mod_cost = 10;
eni_inlining_weights.omp_cost = 40;
eni_inlining_weights.time_based = true;
eni_size_weights.call_cost = 1;
eni_size_weights.target_builtin_call_cost = 1;
eni_size_weights.div_mod_cost = 1;
......
......@@ -3425,7 +3425,7 @@ handle_lhs_call (tree lhs, int flags, VEC(ce_s, heap) *rhsc)
static void
handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
{
struct constraint_expr rhsc, tmpc = {SCALAR, 0, 0};
struct constraint_expr rhsc, tmpc;
tree tmpvar = NULL_TREE;
unsigned int k;
......
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