1 /*===- test/Regression/Transforms/Scalar/DecomposeMultiDimRefs.cpp -----=*
3 * This is a regression test for the DecomposeArrayRefs pass.
4 * It tests several different combinations of structure and
5 * array indexes in individual references. It does *not* yet
6 * sufficiently test type-unsafe operations like treating a
7 * 1-D array as a 2-D or 3-D array. (multidim.ll in this directory
8 * tests a simple case of that though.)
9 *===---------------------------------------------------------------------===*/
14 typedef struct Flat_struct {
19 typedef struct Mixed_struct {
33 for (i=0; i < 10; ++i)
36 for (i=0; i < 10; ++i)
37 for (j=0; j < 10; ++j)
40 for (i=0; i < 10; ++i) {
41 sum += (double) M->F[i].c;
49 InitializeMixed(Mixed_t* M, int base)
53 for (i=0; i < 10; ++i)
56 for (i=0; i < 10; ++i)
57 for (j=0; j < 10; ++j)
58 M->B[i][j] = i*10 + j + base;
60 for (i=0; i < 10; ++i) {
62 M->F[i].x = i / 10 + base;
67 main(int argc, char** argv)
73 InitializeMixed(&M, 100);
74 printf("Sum(M) = %.2f\n", AddMixed(&M));
76 for (i=0; i < 4; i++) {
77 InitializeMixed(&MA[i], 100 * (i+2));
78 printf("Sum(MA[%d]) = %.2f\n", i, AddMixed(&MA[i]));