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

Ian Lance Taylor iant@google.com
Fri Jan 19 15:16:00 GMT 2007


"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.)

Ian



More information about the Gcc-patches mailing list