Commit d3669566 by Jan Hubicka Committed by Jan Hubicka

ipa-inline.c (compute_uninlined_call_time): Return gcov_type.

	* ipa-inline.c (compute_uninlined_call_time): Return gcov_type.
	(compute_inlined_call_time): Watch overflows.
	(relative_time_benefit): Compute in gcov_type.

From-SVN: r193249
parent 1a99ae7b
2012-11-06 Jan Hubicka <jh@suse.cz> 2012-11-06 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (compute_uninlined_call_time): Return gcov_type.
(compute_inlined_call_time): Watch overflows.
(relative_time_benefit): Compute in gcov_type.
2012-11-06 Jan Hubicka <jh@suse.cz>
* cfgloopanal.c (get_loop_hot_path): New function. * cfgloopanal.c (get_loop_hot_path): New function.
* tree-ssa-lop-ivcanon.c (struct loop_size): Add CONSTANT_IV, * tree-ssa-lop-ivcanon.c (struct loop_size): Add CONSTANT_IV,
NUM_NON_PURE_CALLS_ON_HOT_PATH, NUM_PURE_CALLS_ON_HOT_PATH, NUM_NON_PURE_CALLS_ON_HOT_PATH, NUM_PURE_CALLS_ON_HOT_PATH,
...@@ -459,16 +459,16 @@ want_early_inline_function_p (struct cgraph_edge *e) ...@@ -459,16 +459,16 @@ want_early_inline_function_p (struct cgraph_edge *e)
/* Compute time of the edge->caller + edge->callee execution when inlining /* Compute time of the edge->caller + edge->callee execution when inlining
does not happen. */ does not happen. */
inline int inline gcov_type
compute_uninlined_call_time (struct inline_summary *callee_info, compute_uninlined_call_time (struct inline_summary *callee_info,
struct cgraph_edge *edge) struct cgraph_edge *edge)
{ {
int uninlined_call_time = gcov_type uninlined_call_time =
RDIV ((gcov_type)callee_info->time * MAX (edge->frequency, 1), RDIV ((gcov_type)callee_info->time * MAX (edge->frequency, 1),
CGRAPH_FREQ_BASE); CGRAPH_FREQ_BASE);
int caller_time = inline_summary (edge->caller->global.inlined_to gcov_type caller_time = inline_summary (edge->caller->global.inlined_to
? edge->caller->global.inlined_to ? edge->caller->global.inlined_to
: edge->caller)->time; : edge->caller)->time;
return uninlined_call_time + caller_time; return uninlined_call_time + caller_time;
} }
...@@ -479,12 +479,13 @@ inline gcov_type ...@@ -479,12 +479,13 @@ inline gcov_type
compute_inlined_call_time (struct cgraph_edge *edge, compute_inlined_call_time (struct cgraph_edge *edge,
int edge_time) int edge_time)
{ {
int caller_time = inline_summary (edge->caller->global.inlined_to gcov_type caller_time = inline_summary (edge->caller->global.inlined_to
? edge->caller->global.inlined_to ? edge->caller->global.inlined_to
: edge->caller)->time; : edge->caller)->time;
int time = caller_time + RDIV ((edge_time - inline_edge_summary (edge)->call_stmt_time) gcov_type time = (caller_time
* MAX (edge->frequency, 1), + RDIV (((gcov_type) edge_time
CGRAPH_FREQ_BASE); - inline_edge_summary (edge)->call_stmt_time)
* MAX (edge->frequency, 1), CGRAPH_FREQ_BASE));
/* Possible one roundoff error, but watch for overflows. */ /* Possible one roundoff error, but watch for overflows. */
gcc_checking_assert (time >= INT_MIN / 2); gcc_checking_assert (time >= INT_MIN / 2);
if (time < 0) if (time < 0)
...@@ -770,9 +771,9 @@ relative_time_benefit (struct inline_summary *callee_info, ...@@ -770,9 +771,9 @@ relative_time_benefit (struct inline_summary *callee_info,
struct cgraph_edge *edge, struct cgraph_edge *edge,
int edge_time) int edge_time)
{ {
int relbenefit; gcov_type relbenefit;
int uninlined_call_time = compute_uninlined_call_time (callee_info, edge); gcov_type uninlined_call_time = compute_uninlined_call_time (callee_info, edge);
int inlined_call_time = compute_inlined_call_time (edge, edge_time); gcov_type inlined_call_time = compute_inlined_call_time (edge, edge_time);
/* Inlining into extern inline function is not a win. */ /* Inlining into extern inline function is not a win. */
if (DECL_EXTERNAL (edge->caller->global.inlined_to if (DECL_EXTERNAL (edge->caller->global.inlined_to
...@@ -918,7 +919,7 @@ edge_badness (struct cgraph_edge *edge, bool dump) ...@@ -918,7 +919,7 @@ edge_badness (struct cgraph_edge *edge, bool dump)
(int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE, (int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE,
relative_time_benefit (callee_info, edge, edge_time) * 100.0 relative_time_benefit (callee_info, edge, edge_time) * 100.0
/ RELATIVE_TIME_BENEFIT_RANGE, / RELATIVE_TIME_BENEFIT_RANGE,
compute_uninlined_call_time (callee_info, edge), (int)compute_uninlined_call_time (callee_info, edge),
(int)compute_inlined_call_time (edge, edge_time), (int)compute_inlined_call_time (edge, edge_time),
estimate_growth (callee), estimate_growth (callee),
callee_info->growth); callee_info->growth);
......
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