Consider: void f (void) { int *p, *q, *r; int a[10]; p = &a[5]; q = p - 1; r = q - 1; *r = 1; }
Here is what I get from the first CCP. f () { int a[10]; int * r; int * q; int * p; <bb 0>: p_1 = &a[5]; q_2 = &a[4]; r_3 = q_2 - 4B; *r_3 = 1; return; } Note that p_1 and q_2 are of the form &a[CST], but r_3 is not. -- Summary: CCP does not propagate ADDR_EXPR far enough. Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21658