//David Li Loop peeling is special case of index splitting. Gcc has support for this (under -O3 -funrool_loops, also -fno-tree-vectorize for the simple case), but it does not happen for the following cases:
int a[100]; int b[1000]; void foo(int n) { int i; for ( i = 0; i <= n; i++) { b[i*2] = a[3*i+1]; if (i < n) b[i*2] +=1; } } --------------------- int a[100]; int b[1000]; void foo(int n) { int i; for ( i = 0; i < n; i++) { if (i==0) b[i*2] +=1; b[i*2] = a[3*i+1]; } } -- Summary: Loop peeling not happening 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=35357