This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Redesign jump threading profile updates
- From: Jeff Law <law at redhat dot com>
- To: Teresa Johnson <tejohnson at google dot com>, Christophe Lyon <christophe dot lyon at linaro dot org>
- Cc: Sebastian Pop <sebpop at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, David Li <davidxl at google dot com>
- Date: Thu, 02 Oct 2014 12:34:34 -0600
- Subject: Re: [PATCH] Redesign jump threading profile updates
- Authentication-results: sourceware.org; auth=none
- References: <CAAe5K+XMKuBvrA2zbSdA38nq+KiezseL6z_4KayvV322VmJtZQ at mail dot gmail dot com> <53CF1DFD dot 7080805 at redhat dot com> <CAAe5K+UM+gXeSuunYbMz-Ln14kbb5-v0=Ysox1CUQ2esrfwU-A at mail dot gmail dot com> <CAAe5K+UFGUo2YbNXUPnkTh0P7L+UrsKRTLFJdWggQ3i_y0cyQw at mail dot gmail dot com> <CAAe5K+VD=aWnLq3XAUBbRqk9SR1MHiq-VSyd4sxgNmcs8_E2MA at mail dot gmail dot com> <542A32AB dot 1040708 at redhat dot com> <CAAe5K+XX+QVNgW0iY3EfF26nC02Z2_OLMXyaseB7jfbNJ=dFUA at mail dot gmail dot com> <CAKdteOZ-Cy6Eze-yCea=uG70OrjLPpEx3O+TbwFcaCLJWh=CZg at mail dot gmail dot com> <20141001152256 dot GA24862 at f1 dot c dot bardezibar dot internal> <CAKdteOYJ_Htoi8w=+1XLkTvk0zL+qQoWgNOUGJHcJcGmAe8_JQ at mail dot gmail dot com> <CAAe5K+UYd560AShWnDJLG_JvqfrBTONUShwpk+FE_dWD+bE7pg at mail dot gmail dot com> <CAAe5K+XWZEJPkhnM_2TFmh0VN9u_qXpVGfddUZ71YZkD8kMfXg at mail dot gmail dot com>
On 10/01/14 14:04, Teresa Johnson wrote:
The block frequencies are very small in this case leading to rounding
errors when computing the edge frequency. The rounding error was then
propagated into the recomputed probabilities, leading to insanities in
the outgoing edge probabilities on the jump threading path. Eventually
during rtl expansion these insanities somehow caused an ICE.
(Before this patch the probabilities weren't even being updated,
leading to insanities in other cases where they needed to be updated.)
Specifically, in this case we had a block with frequency = 1. It had
two outgoing edges each with probability 50%. Because the
EDGE_FREQUENCY computation uses a rounding divide, the outgoing edge
frequencies were both computed as 1. Later use of these block and edge
frequencies to recompute the probability lead to both outgoing edges
To address this, in the routine freqs_to_counts_path can simply scale
up the frequencies when recording them in the count field. I added a
scale by REG_BR_PROB_BASE. The largest count possible would therefore
be REG_BR_PROB_BASE * BB_FREQ_MAX which is 10000 * 10000 = 100mil
which safely fits in gcov_type.
Here is the patch I am testing. Confirmed it fixes the reported issue.
Currently bootstrapping and testing on x86_64-unknown-linux-gnu. Ok
for trunk if it passes?
(The whitespace is getting messed up when I copy the patch in here -
the indentations do line up in the patch.)
2014-10-01 Teresa Johnson <firstname.lastname@example.org>
* tree-ssa-threadupdate.c (freqs_to_counts_path): Scale frequencies
up when synthesizing counts to avoid rounding errors.