Gcc fully unrolls short trip counted (known) loop if the unrolled loop body
size d oes not exceed a threshold. However, if  the loop has early exit, this
is not done -- leading to missing scalar opt later on.

Example:

int a[100];
int b[100];
int foo(void)
{
     int i, j;

     for (i = 0; i < 5; i ++)
     {
          a[2*i] += a[i];
          if (a[2*i] == 10) break;
     }

     return 0;
}


-- 
           Summary: Early exit loop with short known trip count not unrolled
           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=35341

Reply via email to