Commit ffb77fd6 by Jan Hubicka Committed by Jan Hubicka

ipa-cp.c (estimate_local_effects): Convert sreal to int.

	* ipa-cp.c (estimate_local_effects): Convert sreal to int.
	* ipa-inline-analysis.c (MAX_TIME): Remove.
	(account_size_time): Use sreal for time.
	(dump_inline_summary): Update.
	(estimate_function_body_sizes): Update.
	(estimate_edge_size_and_time): Update.
	(estimate_calls_size_and_time): Update.
	(estimate_node_size_and_time): Update.
	(inline_merge_summary): Update.
	(inline_update_overall_summary): Update.
	(estimate_time_after_inlining): Update.
	(inline_read_section): Update.
	(inline_write_summary): Update.
	* ipa-inline.c (compute_uninlined_call_time): Update.
	(compute_inlined_call_time): Update.
	(recursive_inlining): Update.
	(inline_small_functions): Update.
	(dump_overall_stats): Update.
	* ipa-inline.h: Include sreal.h.
	(size_time_entry): Turn time to sreal.
	(inline_summary): Turn self_time nad time to sreal.

From-SVN: r247277
parent 8a267096
2017-04-25 Jan Hubicka <hubicka@ucw.cz> 2017-04-25 Jan Hubicka <hubicka@ucw.cz>
* ipa-cp.c (estimate_local_effects): Convert sreal to int.
* ipa-inline-analysis.c (MAX_TIME): Remove.
(account_size_time): Use sreal for time.
(dump_inline_summary): Update.
(estimate_function_body_sizes): Update.
(estimate_edge_size_and_time): Update.
(estimate_calls_size_and_time): Update.
(estimate_node_size_and_time): Update.
(inline_merge_summary): Update.
(inline_update_overall_summary): Update.
(estimate_time_after_inlining): Update.
(inline_read_section): Update.
(inline_write_summary): Update.
* ipa-inline.c (compute_uninlined_call_time): Update.
(compute_inlined_call_time): Update.
(recursive_inlining): Update.
(inline_small_functions): Update.
(dump_overall_stats): Update.
* ipa-inline.h: Include sreal.h.
(size_time_entry): Turn time to sreal.
(inline_summary): Turn self_time nad time to sreal.
2017-04-25 Jan Hubicka <hubicka@ucw.cz>
* sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and * sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and
data-streamer.h data-streamer.h
(sreal::stream_out, sreal::stream_in): New. (sreal::stream_out, sreal::stream_in): New.
......
...@@ -2832,7 +2832,7 @@ estimate_local_effects (struct cgraph_node *node) ...@@ -2832,7 +2832,7 @@ estimate_local_effects (struct cgraph_node *node)
vec<ipa_agg_jump_function> known_aggs; vec<ipa_agg_jump_function> known_aggs;
vec<ipa_agg_jump_function_p> known_aggs_ptrs; vec<ipa_agg_jump_function_p> known_aggs_ptrs;
bool always_const; bool always_const;
int base_time = inline_summaries->get (node)->time; int base_time = inline_summaries->get (node)->time.to_int ();
int removable_params_cost; int removable_params_cost;
if (!count || !ipcp_versionable_function_p (node)) if (!count || !ipcp_versionable_function_p (node))
......
...@@ -654,7 +654,7 @@ compute_uninlined_call_time (struct inline_summary *callee_info, ...@@ -654,7 +654,7 @@ compute_uninlined_call_time (struct inline_summary *callee_info,
else else
uninlined_call_time = uninlined_call_time >> 11; uninlined_call_time = uninlined_call_time >> 11;
int caller_time = inline_summaries->get (caller)->time; sreal caller_time = inline_summaries->get (caller)->time;
return uninlined_call_time + caller_time; return uninlined_call_time + caller_time;
} }
...@@ -668,7 +668,7 @@ compute_inlined_call_time (struct cgraph_edge *edge, ...@@ -668,7 +668,7 @@ compute_inlined_call_time (struct cgraph_edge *edge,
cgraph_node *caller = (edge->caller->global.inlined_to cgraph_node *caller = (edge->caller->global.inlined_to
? edge->caller->global.inlined_to ? edge->caller->global.inlined_to
: edge->caller); : edge->caller);
int caller_time = inline_summaries->get (caller)->time; sreal caller_time = inline_summaries->get (caller)->time;
sreal time = edge_time; sreal time = edge_time;
if (edge->count && caller->count) if (edge->count && caller->count)
...@@ -753,6 +753,14 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report) ...@@ -753,6 +753,14 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
int growth = estimate_edge_growth (e); int growth = estimate_edge_growth (e);
inline_hints hints = estimate_edge_hints (e); inline_hints hints = estimate_edge_hints (e);
bool big_speedup = big_speedup_p (e); bool big_speedup = big_speedup_p (e);
/*
fprintf (stderr, "%i %i %i\n",growth,hints,big_speedup);
dump_inline_summary (stderr, e->caller->global.inlined_to ? e->caller->global.inlined_to : e->caller);
dump_inline_summary (stderr, e->callee);
sreal time = compute_uninlined_call_time (inline_summaries->get (e->callee),
e);
sreal inlined_time = compute_inlined_call_time (e, estimate_edge_time (e));
fprintf (stderr, "%f %f\n", time.to_double (), inlined_time.to_double ());*/
if (growth <= 0) if (growth <= 0)
; ;
...@@ -1023,7 +1031,9 @@ edge_badness (struct cgraph_edge *edge, bool dump) ...@@ -1023,7 +1031,9 @@ edge_badness (struct cgraph_edge *edge, bool dump)
edge_time = estimate_edge_time (edge); edge_time = estimate_edge_time (edge);
hints = estimate_edge_hints (edge); hints = estimate_edge_hints (edge);
gcc_checking_assert (edge_time >= 0); gcc_checking_assert (edge_time >= 0);
gcc_checking_assert (edge_time <= callee_info->time); /* FIXME: -1 to care of rounding issues should go away once cache is migrated.
to sreals. */
gcc_checking_assert (edge_time - 1 <= callee_info->time);
gcc_checking_assert (growth <= callee_info->size); gcc_checking_assert (growth <= callee_info->size);
if (dump) if (dump)
...@@ -1554,9 +1564,11 @@ recursive_inlining (struct cgraph_edge *edge, ...@@ -1554,9 +1564,11 @@ recursive_inlining (struct cgraph_edge *edge,
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
"\n Inlined %i times, " "\n Inlined %i times, "
"body grown from size %i to %i, time %i to %i\n", n, "body grown from size %i to %i, time %f to %f\n", n,
inline_summaries->get (master_clone)->size, inline_summaries->get (node)->size, inline_summaries->get (master_clone)->size,
inline_summaries->get (master_clone)->time, inline_summaries->get (node)->time); inline_summaries->get (node)->size,
inline_summaries->get (master_clone)->time.to_double (),
inline_summaries->get (node)->time.to_double ());
/* Remove master clone we used for inlining. We rely that clones inlined /* Remove master clone we used for inlining. We rely that clones inlined
into master clone gets queued just before master clone so we don't into master clone gets queued just before master clone so we don't
...@@ -2052,10 +2064,10 @@ inline_small_functions (void) ...@@ -2052,10 +2064,10 @@ inline_small_functions (void)
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, fprintf (dump_file,
" Inlined into %s which now has time %i and size %i, " " Inlined into %s which now has time %f and size %i, "
"net change of %+i.\n", "net change of %+i.\n",
edge->caller->name (), edge->caller->name (),
inline_summaries->get (edge->caller)->time, inline_summaries->get (edge->caller)->time.to_double (),
inline_summaries->get (edge->caller)->size, inline_summaries->get (edge->caller)->size,
overall_size - old_size); overall_size - old_size);
} }
...@@ -2245,7 +2257,7 @@ dump_overall_stats (void) ...@@ -2245,7 +2257,7 @@ dump_overall_stats (void)
if (!node->global.inlined_to if (!node->global.inlined_to
&& !node->alias) && !node->alias)
{ {
int time = inline_summaries->get (node)->time; int time = inline_summaries->get (node)->time.to_double ();
sum += time; sum += time;
sum_weighted += time * node->count; sum_weighted += time * node->count;
} }
......
...@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_IPA_INLINE_H #ifndef GCC_IPA_INLINE_H
#define GCC_IPA_INLINE_H #define GCC_IPA_INLINE_H
#include "sreal.h"
/* Representation of inline parameters that do depend on context function is /* Representation of inline parameters that do depend on context function is
inlined into (i.e. known constant values of function parameters. inlined into (i.e. known constant values of function parameters.
...@@ -109,7 +111,7 @@ struct GTY(()) size_time_entry ...@@ -109,7 +111,7 @@ struct GTY(()) size_time_entry
{ {
struct predicate predicate; struct predicate predicate;
int size; int size;
int time; sreal GTY((skip)) time;
}; };
/* Function inlining information. */ /* Function inlining information. */
...@@ -122,7 +124,7 @@ struct GTY(()) inline_summary ...@@ -122,7 +124,7 @@ struct GTY(()) inline_summary
/* Size of the function body. */ /* Size of the function body. */
int self_size; int self_size;
/* Time of the function body. */ /* Time of the function body. */
int self_time; sreal GTY((skip)) self_time;
/* Minimal size increase after inlining. */ /* Minimal size increase after inlining. */
int min_size; int min_size;
...@@ -146,7 +148,7 @@ struct GTY(()) inline_summary ...@@ -146,7 +148,7 @@ struct GTY(()) inline_summary
/* Expected offset of the stack frame of inlined function. */ /* Expected offset of the stack frame of inlined function. */
HOST_WIDE_INT stack_frame_offset; HOST_WIDE_INT stack_frame_offset;
/* Estimated size of the function after inlining. */ /* Estimated size of the function after inlining. */
int time; sreal GTY((skip)) time;
int size; int size;
/* Conditional size/time information. The summaries are being /* Conditional size/time information. The summaries are being
......
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