This is the mail archive of the java@gcc.gnu.org mailing list for the Java 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]

VRP? (was Re: PATCH: Re: gcj non-optimization curiosity)


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;
>}
>



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