Here's a final version. I've used !compare_step.is_negative ().
Moreover, sanity checked by printing out old and new probability
and comparing them after check-gcc. So this should be prety safe now.
I will apply the patch shortly.
2013-03-08 Marek Polacek
Jakub Jelinek
On Fri, Mar 8, 2013 at 1:30 PM, Jakub Jelinek wrote:
> On Fri, Mar 08, 2013 at 01:16:37PM +0100, Marek Polacek wrote:
>> --- gcc/predict.c.mp 2013-03-07 20:01:01.078417558 +0100
>> +++ gcc/predict.c 2013-03-08 11:35:05.227603993 +0100
>> @@ -1028,13 +1028,13 @@ static bool
>> is_comparison_w
On Fri, Mar 08, 2013 at 01:16:37PM +0100, Marek Polacek wrote:
> --- gcc/predict.c.mp 2013-03-07 20:01:01.078417558 +0100
> +++ gcc/predict.c 2013-03-08 11:35:05.227603993 +0100
> @@ -1028,13 +1028,13 @@ static bool
> is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop,
>
On Thu, Mar 07, 2013 at 03:25:35PM +0100, Jakub Jelinek wrote:
> On Tue, Mar 05, 2013 at 10:07:50AM +0100, Marek Polacek wrote:
> > + if (compare_count.scmp (double_int_zero) == -1)
> > +compare_count = double_int_zero;
> > + if (loop_count.scmp (double_int_zero) == -1)
> > +
On Tue, Mar 05, 2013 at 10:07:50AM +0100, Marek Polacek wrote:
> + if (compare_count.scmp (double_int_zero) == -1)
> +compare_count = double_int_zero;
> + if (loop_count.scmp (double_int_zero) == -1)
> +loop_count = double_int_zero;
Use if (compare_count.is_negative ()) e
On Fri, Mar 01, 2013 at 11:10:40AM +0100, Richard Biener wrote:
> Don't use NULL_TREE built_int_cst - doing so hints at that you want to
> use double_ints. Generally doing computation with trees is expensive.
> You want to avoid that at all cost. Use double-ints (yeah, you have to
> use the clunk
On Thu, Feb 28, 2013 at 7:43 PM, Jakub Jelinek wrote:
> On Thu, Feb 28, 2013 at 07:27:48PM +0100, Marek Polacek wrote:
>> The hunk
>> probability = (double) REG_BR_PROB_BASE * compare_count / loop_count;
>> in there should be probably handled in the same way. But I'll handle
>> that separately.
>
On Thu, Feb 28, 2013 at 07:27:48PM +0100, Marek Polacek wrote:
> The hunk
> probability = (double) REG_BR_PROB_BASE * compare_count / loop_count;
> in there should be probably handled in the same way. But I'll handle
> that separately.
>
> In the first hunk, I did s/int/HOST_WIDE_INT/, because H
The following testcase ICEd because we were trying to negate
"-9223372036854775808", which results in UB, since it's LLONG_MAX + 1.
Then we got a SIGFPE on
-LLONG_MIN / -1
So fixed by doing the arithmetics on trees, and in case we got
an overflow, we bail out.
The hunk
probability = (double) REG_