This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
tree-ssa: a weird (mis)optimization
- From: Andrew Haley <aph at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 30 Nov 2004 16:07:02 +0000
- Subject: tree-ssa: a weird (mis)optimization
One of the Java test cases is failing because of an incorrect
optimization.
Here's the function in the t18.copyrename1 dump:
;; Function Array_3.baz() (_ZN7Array_33bazEv)
Array_3.baz() ()
{
int <tmp>;
int nn;
struct int[] * x;
int D.631;
int D.630;
int retval.0;
<bb 0>:
_Jv_InitClass (&Array_3.class);
x_3 = 0B;
<tmp>_4 = x_3->length;
<tmp>_5 = <tmp>_4;
<tmp>_6 = <tmp>_5;
nn_7 = <tmp>_6;
D.631_8 = 5;
return D.631_8;
}
And here it is in the t19.dce1 dump:
;; Function Array_3.baz() (_ZN7Array_33bazEv)
Array_3.baz() ()
{
int <tmp>;
int nn;
struct int[] * x;
int D.631;
int D.630;
int retval.0;
<bb 0>:
_Jv_InitClass (&Array_3.class);
D.631_8 = 5;
return D.631_8;
}
The problem here is that the line
<tmp>_4 = x_3->length;
has disappeared. This should not have happened, because the operation
should have may_trap_p() set -- we're deleting a trapping instruction.
Andrew.