PATCH RFC: Change some tree-ssa-operands fields to unsigned

Richard Guenther richard.guenther@gmail.com
Fri Jan 19 15:26:00 GMT 2007


On 19 Jan 2007 07:16:03 -0800, Ian Lance Taylor <iant@google.com> wrote:
> "Richard Guenther" <richard.guenther@gmail.com> writes:
>
> > Did you inspect the resulting code from your patch to see if we
> > somehow optimize the loop worse if you use unsigned ints?  If not
> > I think it is perfectly reasonable to encode semantic restrictions
> > in the type we use.
>
> The resulting code is essentially the same, and is sometimes two
> instructions shorter, depending on how clever VRP/fold-const was able
> to be on the original code.
>
> Sample diff:
>
> -test   %edx,%edx
> -js     4900 <verify_ssa+0xc80>
> -cmp    0x8(%ebx),%edx
> -jge    4900 <verify_ssa+0xc80>
> +cmp    0x8(%ecx),%edx
> +jae    4c95 <verify_ssa+0xe05>
>
> (Frankly I'm surprised that the result is ever different at all.  This
> raises the question of why we don't always convert
>     i >= 0 && i < N
> into
>     (unsigned) i < N
> but I haven't pursued that.  There is code for this in
> build_range_check but it seems to not always fire.)

Note that we also have the problem that _if_ it fires,
VRP will no longer be able to derive a range for i from
it (PR30317).

Richard.



More information about the Gcc-patches mailing list