This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]