This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[GOOGLE] tune loop scale factor for AutoFDO
- 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, 8 Nov 2013 06:23:39 -0800
- Subject: [GOOGLE] tune loop scale factor for AutoFDO
- Authentication-results: sourceware.org; auth=none
AutoFDO sometimes has 0 profile in the loop's entry block because the
debug info are lost and unrecoverable.
E.g.
if (a)
if (b)
for () {}
This patch checks if the scale factor is 0, then use the normal scale.
Bootstrapped and passed regression test and performance test.
OK for google-4_8?
Thanks,
Dehao
Index: gcc/cfgloopmanip.c
===================================================================
--- gcc/cfgloopmanip.c (revision 204568)
+++ gcc/cfgloopmanip.c (working copy)
@@ -1262,6 +1262,8 @@ duplicate_loop_to_header_edge (struct loop *loop,
}
for (i = 0; i < ndupl; i++)
gcc_assert (scale_step[i] >= 0 && scale_step[i] <= REG_BR_PROB_BASE);
+ if (flag_auto_profile && scale_main == 0)
+ scale_main = REG_BR_PROB_BASE;
gcc_assert (scale_main >= 0 && scale_main <= REG_BR_PROB_BASE
&& scale_act >= 0 && scale_act <= REG_BR_PROB_BASE);
}