aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-10-07 20:58:04 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2012-10-07 18:58:04 +0000
commited901e4c617dec0b7388b2410e802545a2a55bb0 (patch)
treefe7a69511297e157ec48839981853e440e96771d
parente75f8f79f086dac6fa2944875f0fbfdf14644687 (diff)
downloadgcc-ed901e4c617dec0b7388b2410e802545a2a55bb0.zip
gcc-ed901e4c617dec0b7388b2410e802545a2a55bb0.tar.gz
gcc-ed901e4c617dec0b7388b2410e802545a2a55bb0.tar.bz2
ipa-inline-analysis.c (do_estimate_edge_time): Return actual time spent by the inlined sequence.
* ipa-inline-analysis.c (do_estimate_edge_time): Return actual time spent by the inlined sequence. (do_estimate_edge_growth): Rename to ... (do_estimate_edge_time): ... this one; return size of inlined sequence. * ipa-inline.h (do_estimate_edge_size): New. (do_estimate_edge_growth): Remove. (estimate_edge_size): New function. (estimate_edge_growth): Use it. From-SVN: r192185
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/ipa-inline-analysis.c17
-rw-r--r--gcc/ipa-inline.h19
3 files changed, 33 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9543444..d6824e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,17 @@
2012-10-07 Jan Hubicka <jh@suse.cz>
+ * ipa-inline-analysis.c (do_estimate_edge_time): Return actual
+ time spent by the inlined sequence.
+ (do_estimate_edge_growth): Rename to ...
+ (do_estimate_edge_time): ... this one; return size of inlined
+ sequence.
+ * ipa-inline.h (do_estimate_edge_size): New.
+ (do_estimate_edge_growth): Remove.
+ (estimate_edge_size): New function.
+ (estimate_edge_growth): Use it.
+
+2012-10-07 Jan Hubicka <jh@suse.cz>
+
* lto-cgraph.c (lto_symtab_encoder_new): New parameter FOR_INPUT.
(lto_symtab_encoder_delete): Update.
(lto_symtab_encoder_encode): Update.
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 31ecec9..6cea942 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -3312,14 +3312,12 @@ do_estimate_edge_time (struct cgraph_edge *edge)
VEC_free (tree, heap, known_binfos);
VEC_free (ipa_agg_jump_function_p, heap, known_aggs);
- ret = (((gcov_type)time
- - es->call_stmt_time) * edge->frequency
- + CGRAPH_FREQ_BASE / 2) / CGRAPH_FREQ_BASE;
+ ret = RDIV ((gcov_type)time * edge->frequency,
+ CGRAPH_FREQ_BASE);
/* When caching, update the cache entry. */
if (edge_growth_cache)
{
- int ret_size;
if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache)
<= edge->uid)
VEC_safe_grow_cleared (edge_growth_cache_entry, heap, edge_growth_cache,
@@ -3327,10 +3325,8 @@ do_estimate_edge_time (struct cgraph_edge *edge)
VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).time
= ret + (ret >= 0);
- ret_size = size - es->call_stmt_size;
- gcc_checking_assert (es->call_stmt_size);
VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).size
- = ret_size + (ret_size >= 0);
+ = size + (size >= 0);
VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).hints
= hints + 1;
}
@@ -3338,11 +3334,11 @@ do_estimate_edge_time (struct cgraph_edge *edge)
}
-/* Estimate the growth of the caller when inlining EDGE.
+/* Return estimated callee growth after inlining EDGE.
Only to be called via estimate_edge_size. */
int
-do_estimate_edge_growth (struct cgraph_edge *edge)
+do_estimate_edge_size (struct cgraph_edge *edge)
{
int size;
struct cgraph_node *callee;
@@ -3375,8 +3371,7 @@ do_estimate_edge_growth (struct cgraph_edge *edge)
VEC_free (tree, heap, known_vals);
VEC_free (tree, heap, known_binfos);
VEC_free (ipa_agg_jump_function_p, heap, known_aggs);
- gcc_checking_assert (inline_edge_summary (edge)->call_stmt_size);
- return size - inline_edge_summary (edge)->call_stmt_size;
+ return size;
}
diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h
index ec9cf4d..df8b3a7 100644
--- a/gcc/ipa-inline.h
+++ b/gcc/ipa-inline.h
@@ -201,7 +201,7 @@ void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
int do_estimate_growth (struct cgraph_node *);
void inline_merge_summary (struct cgraph_edge *edge);
void inline_update_overall_summary (struct cgraph_node *node);
-int do_estimate_edge_growth (struct cgraph_edge *edge);
+int do_estimate_edge_size (struct cgraph_edge *edge);
int do_estimate_edge_time (struct cgraph_edge *edge);
inline_hints do_estimate_edge_hints (struct cgraph_edge *edge);
void initialize_growth_caches (void);
@@ -245,20 +245,31 @@ estimate_growth (struct cgraph_node *node)
}
-/* Return estimated callee growth after inlining EDGE. */
+/* Return estimated size of the inline sequence of EDGE. */
static inline int
-estimate_edge_growth (struct cgraph_edge *edge)
+estimate_edge_size (struct cgraph_edge *edge)
{
int ret;
if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
|| !(ret = VEC_index (edge_growth_cache_entry,
edge_growth_cache,
edge->uid).size))
- return do_estimate_edge_growth (edge);
+ return do_estimate_edge_size (edge);
return ret - (ret > 0);
}
+/* Return estimated callee growth after inlining EDGE. */
+
+static inline int
+estimate_edge_growth (struct cgraph_edge *edge)
+{
+#ifdef ENABLE_CHECKING
+ gcc_checking_assert (inline_edge_summary (edge)->call_stmt_size);
+#endif
+ return (estimate_edge_size (edge)
+ - inline_edge_summary (edge)->call_stmt_size);
+}
/* Return estimated callee runtime increase after inlning
EDGE. */