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

John Wehle john@feith.com
Tue Dec 18 11:01:00 GMT 2001


> Yeah. I wonder if this is something that John Wehle's value range 
> propagation pass can optimize?

Unfortunately not at the moment. Currently VRP can optimize:
struct z
{
 const int length;
 int ary[0];
};
extern struct z *foo ();
int main ()
{
 struct z *l = foo ();
 int i;
 int x = 0;
 int j = 10;
 for (i = 0; i < j; ++i)
 {
 if ((unsigned) i >= (unsigned) (j))
 throw 1;
 x += l->ary[i];
 }
 return x;
}
Two problems handling your example:
 1) VRP currently tracks ranges for pseudo registers. l->length
 involves a mem.
 2) Assigning l->length to a pseudo (i.e. j) yields:
...
BB 3
 reg 62
 min <integer_cst 850382c 0> max <integer_cst 85038a0 2147483646>
 reg 64
 min <integer_cst 8503d04 1> max <integer_cst 8503d78 2147483647>
...
 VRP determines the correct ranges for i (reg 62) and j (reg 64) however
 fails to realize that i will always be less than any given j when the
 if is evaluated. It would probably need to use something other than
 absolute ranges in order to handle this.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /