// David Li: Conditional generator is not handled, missing redundancy elimination for a[i] and a[i-1]
int a[1000]; int b[1000]; void foo(int n) { int i = 1; for(; i < n; i++) { if (b[i] > 0) a[i+1] = a[i-1]; b[i] = a[i]; } } ==> should be (similar to PRE) Conditional generator is not handled, missing redundancy elimination for a[i] and a[i-1] int a[1000]; int b[1000]; t1 = a[0]; t2 = a[1]; void foo(int n) { int i = 1; for(; i < n; i++) { if (b[i] > 0) { t3 = t1; a[i+1] = t3; } else t3 = a[i+1]; b[i] = t2; t1 = t2; t2 = t3; } } (Loop can be unrolled to reduce copy) -- Summary: Scalar replacement -- handling of conditional generator -- missing Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: xinliangli at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35346