On 03/02/2017 08:58 PM, Bernd Schmidt wrote:
> On 03/02/2017 06:50 PM, Martin Liška wrote:
>> Hello.
>>
>> This is second part of fixes needed to not trigger integer overflow in gcse 
>> pass.
> 
> So, how is this intended to work? The min/max stored in the param is an int, 
> and by using a HOST_WIDE_INT here, we expect that it is a larger type and 
> therefore won't overflow?

Using int type is fine, but as gcse.c does an arithmetic with a distance:

          /* Prefer to hoist EXPR if register pressure is decreased.  */
          if (decreased_pressure > *nregs)
            distance += bb_size[bb->index];

...

                    max_distance += (bb_size[dominated->index]
                                     - to_bb_head[INSN_UID (occr->insn)]);


> 
>>        {
>>      expr = flat_table[i];
>>      fprintf (file, "Index %d (hash value %d; max distance %d)\n  ",
>> -         expr->bitmap_index, hash_val[i], expr->max_distance);
>> +         expr->bitmap_index, hash_val[i], (int)expr->max_distance);
>>      print_rtl (file, expr->expr);
>>      fprintf (file, "\n");
> 
> Use HOST_WIDE_INT_PRINT_DEC maybe? Otherwise OK, I guess.

That's for nit, I'll install the patch with that.

Martin

> 
> 
> Bernd

Reply via email to