This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
VRP? (was Re: PATCH: Re: gcj non-optimization curiosity)
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: tromey at redhat dot com
- Cc: java at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Tue, 18 Dec 2001 12:47:48 +1300
- Subject: VRP? (was Re: PATCH: Re: gcj non-optimization curiosity)
- References: <87vgf628c4.fsf@creche.redhat.com> <3C1D723A.7000803@waitaki.otago.ac.nz> <878zc1trlq.fsf@creche.redhat.com>
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;
>}
>