[GOOGLE] Restrict the count_scale to be no larger than 100%
Dehao Chen
dehao@google.com
Fri Jan 17 22:38:00 GMT 2014
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;
More information about the Gcc-patches
mailing list