VRP? (was Re: PATCH: Re: gcj non-optimization curiosity)
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Mon Dec 17 15:46:00 GMT 2001
Tom Tromey wrote:
>The more-or-less equivalent C++ code, appended, also generates a
>redundant bounds check. Perhaps our optimizer simply can't do this
>yet.
>
Yeah. I wonder if this is something that John Wehle's value range
propagation pass can optimize? If not then it should be possible to do
it at the tree level with the help of SSA.
>struct z
>{
> const int length;
> int ary[0];
>};
>>extern struct z *foo ();
>>>int main ()
>{
> struct z *l = foo ();
> int i;
> int x = 0;
>> for (i = 0; i < l->length; ++i)
> {
> if ((unsigned) i >= (unsigned) (l->length))
> throw 1;
> x += l->ary[i];
> }
>> return x;
>}
>
More information about the Java
mailing list