summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-23 20:01:29 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-23 20:01:29 +0000
commit5fce5299af4810e08744160f9387d11ef1623a94 (patch)
treec9663c118c473b5fc50a9f3781ed3452e9f94056 /gcc/ipa-cp.c
parente74b076da6338645b4e2010f97ef50577b314d5f (diff)
downloadgcc-5fce5299af4810e08744160f9387d11ef1623a94.tar.gz
* ipa-cp.c (ipcp_compute_node_scale): Work around completely
wrong profile updates. * predict.c (counts_to_freqs): Be expected for ENTRY/EXIT block having largest frequency. * ira-live.c (ira_implicitly_set_insn_hard_regs): Silecne used uninitalized warning. * tree-optimize.c (execute_fixup_cfg): Rescale entry and exit block frequencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154462 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 4b632c0d9fb..2af2c7f2d6f 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -578,7 +578,13 @@ build_const_val (struct ipcp_lattice *lat, tree tree_type)
/* Compute the proper scale for NODE. It is the ratio between the number of
direct calls (represented on the incoming cgraph_edges) and sum of all
- invocations of NODE (represented as count in cgraph_node). */
+ invocations of NODE (represented as count in cgraph_node).
+
+ FIXME: This code is wrong. Since the callers can be also clones and
+ the clones are not scaled yet, the sums gets unrealistically high.
+ To properly compute the counts, we would need to do propagation across
+ callgraph (as external call to A might imply call to non-clonned B
+ if A's clone calls clonned B). */
static void
ipcp_compute_node_scale (struct cgraph_node *node)
{
@@ -589,6 +595,12 @@ ipcp_compute_node_scale (struct cgraph_node *node)
/* Compute sum of all counts of callers. */
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
sum += cs->count;
+ /* Work around the unrealistically high sum problem. We just don't want
+ the non-cloned body to have negative or very low frequency. Since
+ majority of execution time will be spent in clones anyway, this should
+ give good enough profile. */
+ if (sum > node->count * 9 / 10)
+ sum = node->count * 9 / 10;
if (node->count == 0)
ipcp_set_node_scale (node, 0);
else