1; RUN: opt < %s -analyze -enable-new-pm=0 -delinearize | FileCheck %s 2; RUN: opt < %s -passes='print<delinearization>' -disable-output 2>&1 | FileCheck %s 3 4; void foo(long n, long m, long o, double A[n][m][o]) { 5; 6; for (long i = 0; i < n; i++) 7; for (long j = 0; j < m; j++) 8; for (long k = 0; k < o; k++) 9; A[i][j][k] = 1.0; 10; } 11 12; AddRec: {{{%A,+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j>,+,8}<%for.k> 13; CHECK: Base offset: %A 14; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of 8 bytes. 15; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>][{0,+,1}<nuw><nsw><%for.k>] 16 17define void @foo(i64 %n, i64 %m, i64 %o, double* %A) { 18entry: 19 br label %for.i 20 21for.i: 22 %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ] 23 br label %for.j 24 25for.j: 26 %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j.inc ] 27 br label %for.k 28 29for.k: 30 %k = phi i64 [ 0, %for.j ], [ %k.inc, %for.k.inc ] 31 %subscript0 = mul i64 %i, %m 32 %subscript1 = add i64 %j, %subscript0 33 %subscript2 = mul i64 %subscript1, %o 34 %subscript = add i64 %subscript2, %k 35 %idx = getelementptr inbounds double, double* %A, i64 %subscript 36 store double 1.0, double* %idx 37 br label %for.k.inc 38 39for.k.inc: 40 %k.inc = add nsw i64 %k, 1 41 %k.exitcond = icmp eq i64 %k.inc, %o 42 br i1 %k.exitcond, label %for.j.inc, label %for.k 43 44for.j.inc: 45 %j.inc = add nsw i64 %j, 1 46 %j.exitcond = icmp eq i64 %j.inc, %m 47 br i1 %j.exitcond, label %for.i.inc, label %for.j 48 49for.i.inc: 50 %i.inc = add nsw i64 %i, 1 51 %i.exitcond = icmp eq i64 %i.inc, %n 52 br i1 %i.exitcond, label %end, label %for.i 53 54end: 55 ret void 56} 57