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: [tcb] Value Range Propagation


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

>> Take a look at the appended example.  It is analogous to the situation
>> with java arrays.  If you compile it as is, the dead __cxa_throw call
>> will not be removed.  If you define WORK_WORK_WORK, the dead call will
>> be removed.

Andrew> Well, I can easily change that to remove the cast.  But if I do, the
Andrew> check will mutate into
Andrew> if (i >= 0 && i < a->len)
Andrew> but I hope the compiler will have the good sense to turn that back
Andrew> into an unsigned comparison.

I changed my little program to use 'int' and this test:

  if (i < 0 || i >= a->len)

... and VRP still did not remove the throw.
So, some work on VRP will still be needed, I think.

IMO if the optimizers can be smart about turning this into an unsigned
compare, VRP can also be smart about handling unsigned compares.  But
I suppose the exact shape of the result doesn't matter much to me, as
long as it works.

Tom


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