1 ; RUN: opt < %s -passes='print<delinearization>' -disable-output 2>&1 | FileCheck %s
3 ; void foo(long n, long m, long o, double A[n][m][o]) {
5 ; for (long i = 0; i < n; i++)
6 ; for (long j = 0; j < m; j++)
7 ; for (long k = 0; k < o; k++)
11 ; AddRec: {{{%A,+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j>,+,8}<%for.k>
12 ; CHECK: Base offset: %A
13 ; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of 8 bytes.
14 ; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>][{0,+,1}<nuw><nsw><%for.k>]
16 define void @foo(i64 %n, i64 %m, i64 %o, ptr %A) {
21 %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ]
25 %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j.inc ]
29 %k = phi i64 [ 0, %for.j ], [ %k.inc, %for.k.inc ]
30 %subscript0 = mul i64 %i, %m
31 %subscript1 = add i64 %j, %subscript0
32 %subscript2 = mul i64 %subscript1, %o
33 %subscript = add i64 %subscript2, %k
34 %idx = getelementptr inbounds double, ptr %A, i64 %subscript
35 store double 1.0, ptr %idx
39 %k.inc = add nsw i64 %k, 1
40 %k.exitcond = icmp eq i64 %k.inc, %o
41 br i1 %k.exitcond, label %for.j.inc, label %for.k
44 %j.inc = add nsw i64 %j, 1
45 %j.exitcond = icmp eq i64 %j.inc, %m
46 br i1 %j.exitcond, label %for.i.inc, label %for.j
49 %i.inc = add nsw i64 %i, 1
50 %i.exitcond = icmp eq i64 %i.inc, %n
51 br i1 %i.exitcond, label %end, label %for.i