When loop bound condition is <=, number_of_iterations_in_loop returns 'unknown' 
although the loop is countable. Turns out this case is pretty common in SPEC 
and blocks vectorization opportunities.
E.g.,
int foo ()
{
  int a[N];
  int i;
  int n;

  for (i = 0; i <= n; i++)
    {
      ca[i] = 2;
    }
}

In order to check loop bound for overflow (in function 
number_of_iterations_exit), conditions before loop are checked (in 
simplify_using_initial_conditions). However, there is no relevant condition 
before the loop. The condition is n >= 0 and the expression to check  n != 
2147483647.

-- 
           Summary: Missed optimization
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: irar at il dot ibm dot com
                CC: dorit at il dot ibm dot com,gcc-bugs at gcc dot gnu dot
                    org,rakdver at atrey dot karlin dot mff dot cuni dot cz
 GCC build triplet: powerpc-apple-darwin7.0.0
  GCC host triplet: powerpc-apple-darwin7.0.0
GCC target triplet: powerpc-apple-darwin7.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18527

Reply via email to