2011-07-28 08:11:03 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin -Os -S -g -o - %s | FileCheck %s
|
2011-11-01 11:48:36 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2011-07-06 05:48:46 +08:00
|
|
|
|
|
|
|
int calculate(int);
|
|
|
|
static void test_indvars(int *Array1, int Array2[100][200]) {
|
|
|
|
unsigned i, j;
|
|
|
|
Array1[1] = Array2[3][6] = 12345;
|
|
|
|
|
|
|
|
for (i = 0; i < 100; i+=2)
|
2013-12-05 12:47:09 +08:00
|
|
|
Array1[i] = i; /* Step by non-unit amount */
|
2011-07-06 05:48:46 +08:00
|
|
|
|
|
|
|
for (i = 3; i < 103; i++)
|
|
|
|
Array1[i] = i+4; /* Step with an offset */
|
|
|
|
|
|
|
|
for (i = 13; i < 100; i++)
|
|
|
|
for (j = 0; j < 100; j+=3) /* 2d array access */
|
|
|
|
Array2[i][j/3] = Array2[i][i];
|
2011-07-28 08:11:03 +08:00
|
|
|
}
|
2011-07-06 05:48:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int Array[100][200], i, j;
|
|
|
|
double sum = 0.0;
|
2011-07-28 08:11:03 +08:00
|
|
|
|
2011-07-06 05:48:46 +08:00
|
|
|
for (i=0; i < 100; i+=2)
|
|
|
|
for (j=0; j < 200; j++)
|
|
|
|
Array[i][j] = 0;
|
|
|
|
test_indvars(Array[0], Array);
|
|
|
|
|
2012-10-19 05:52:18 +08:00
|
|
|
//CHECK: .loc 2 31
|
2011-07-06 05:48:46 +08:00
|
|
|
for (i=0; i < 100; i+=2)
|
|
|
|
for (j=0; j < 200; j++)
|
|
|
|
sum += Array[i][j];
|
2011-07-28 08:11:03 +08:00
|
|
|
|
2011-07-06 05:48:46 +08:00
|
|
|
return calculate(sum);
|
|
|
|
}
|