Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -Os -S -g  -o - %s | FileCheck %s
      2 // REQUIRES: x86-registered-target
      3 
      4 int calculate(int);
      5 static void test_indvars(int *Array1, int Array2[100][200]) {
      6   unsigned i, j;
      7   Array1[1] = Array2[3][6] = 12345;
      8 
      9   for (i = 0; i < 100; i+=2)
     10     Array1[i] = i;           /* Step by non unit amount */
     11 
     12   for (i = 3; i < 103; i++)
     13     Array1[i] = i+4;         /* Step with an offset */
     14 
     15   for (i = 13; i < 100; i++)
     16     for (j = 0; j < 100; j+=3)       /* 2d array access */
     17       Array2[i][j/3] = Array2[i][i];
     18 }
     19 
     20 
     21 int main() {
     22   int Array[100][200], i, j;
     23   double sum = 0.0;
     24 
     25   for (i=0; i < 100; i+=2)
     26     for (j=0; j < 200; j++)
     27       Array[i][j] = 0;
     28   test_indvars(Array[0], Array);
     29 
     30 //CHECK:	.loc	2 31
     31   for (i=0; i < 100; i+=2)
     32     for (j=0; j < 200; j++)
     33       sum += Array[i][j];
     34 
     35   return calculate(sum);
     36 }
     37