blob: f3d5eee6e7d2d4ef8b55667eece88bf80671b36b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
2011-05-03 Tom de Vries <tom@codesourcery.com>
gcc/
* stmt.c (set_jump_prob): Make robust against *inv_scale == 0.
=== modified file 'gcc/stmt.c'
--- old/gcc/stmt.c 2011-02-07 13:23:30 +0000
+++ new/gcc/stmt.c 2011-05-06 19:17:34 +0000
@@ -2312,7 +2312,9 @@
set_jump_prob (rtx jump, int prob, int *inv_scale)
{
/* j[i] = p[i] * scale / REG_BR_PROB_BASE. */
- int jump_prob = prob * REG_BR_PROB_BASE / *inv_scale;
+ int jump_prob = (*inv_scale > 0
+ ? prob * REG_BR_PROB_BASE / *inv_scale
+ : REG_BR_PROB_BASE / 2);
/* f[i] = REG_BR_PROB_BASE - j[i]. */
int fallthrough_prob = REG_BR_PROB_BASE - jump_prob;
|