This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[GOOGLE] Restrict the count_scale to be no larger than 100%
- From: Dehao Chen <dehao at google dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: David Li <davidxl at google dot com>
- Date: Fri, 17 Jan 2014 14:38:20 -0800
- Subject: [GOOGLE] Restrict the count_scale to be no larger than 100%
- Authentication-results: sourceware.org; auth=none
In AutoFDO, sometime edge count might be propagated to be too large
due to bad debug info. In this cases, we need to make sure the count
scale is no larger than 100% otherwise it'll make real hot code cold.
Bootstrapped and passed regression test. Performance test on-going.
OK for google-4_8 if performance test is ok?
Thanks,
Dehao
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c (revision 206721)
+++ gcc/tree-inline.c (working copy)
@@ -2262,6 +2262,9 @@ copy_cfg_body (copy_body_data * id, gcov_type coun
else
count_scale = REG_BR_PROB_BASE;
+ if (flag_auto_profile && count_scale > REG_BR_PROB_BASE)
+ count_scale = REG_BR_PROB_BASE;
+
/* Register specific tree functions. */
gimple_register_cfg_hooks ();
Index: gcc/cgraphclones.c
===================================================================
--- gcc/cgraphclones.c (revision 206721)
+++ gcc/cgraphclones.c (working copy)
@@ -216,7 +216,10 @@ cgraph_clone_node (struct cgraph_node *n, tree dec
count, we will not update the original callee because it may
mistakenly mark some hot function as cold. */
if (flag_auto_profile && count >= n->count)
- update_original = false;
+ {
+ update_original = false;
+ new_node->count = n->count;
+ }
if (update_original)
{
n->count -= count;