The following code we miss one ccp optimization:
struct f
{
int i;
};
int g()throw()
{
f a;
a.i = 1;
f *a1 = &a;
int *i = &a1->i;
return *i; /* This should be turned into a.i */
}
We get right now:
Visiting statement:
a1_3 = &a;
Lattice value changed to CONSTANT &a. Adding SSA edges to worklist.
Visiting statement:
i_4 = &a1_3->i;
Lattice value changed to VARYING. Adding SSA edges to worklist.
Adding Destination of edge (0 -> 2) to worklist
we should see that the lattice value for &a1_3->i is really constant if a1_3 is
constant.
--
Summary: Missed ccp optimization
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21636