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: John Wehle <john at feith dot com>
- To: bryce at waitaki dot otago dot ac dot nz
- Cc: java at gcc dot gnu dot org, gcc at gcc dot gnu dot org, tromey at redhat dot com
- Date: Tue, 18 Dec 2001 14:00:01 -0500 (EST)
- Subject: VRP? (was Re: PATCH: Re: gcj non-optimization curiosity)
> 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 | |
-------------------------------------------------------------------------