1; RUN: opt < %s -analyze -delinearize | FileCheck %s 2 3; Derived from the following code: 4; 5; void foo(long n, long m, double A[n][m]) { 6; for (long i = 0; i < n; i++) 7; for (long j = 0; j < m; j++) 8; A[i][j] = 1.0; 9; } 10 11; Inst: %val = load double, double* %arrayidx 12; In Loop with Header: for.j 13; AddRec: {{0,+,(%m * 8)}<%for.i>,+,8}<%for.j> 14; Base offset: %A 15; ArrayDecl[UnknownSize][%m] with elements of 8 bytes. 16; ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>] 17 18; Inst: store double %val, double* %arrayidx 19; In Loop with Header: for.j 20; AddRec: {{%A,+,(8 * %m)}<%for.i>,+,8}<%for.j> 21; CHECK: Base offset: %A 22; CHECK: ArrayDecl[UnknownSize][%m] with elements of 8 bytes. 23; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>] 24 25define void @foo(i64 %n, i64 %m, double* %A) { 26entry: 27 br label %for.i 28 29for.i: 30 %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ] 31 %tmp = mul nsw i64 %i, %m 32 br label %for.j 33 34for.j: 35 %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j ] 36 %vlaarrayidx.sum = add i64 %j, %tmp 37 %arrayidx = getelementptr inbounds double, double* %A, i64 %vlaarrayidx.sum 38 %val = load double, double* %arrayidx 39 store double %val, double* %arrayidx 40 %j.inc = add nsw i64 %j, 1 41 %j.exitcond = icmp eq i64 %j.inc, %m 42 br i1 %j.exitcond, label %for.i.inc, label %for.j 43 44for.i.inc: 45 %i.inc = add nsw i64 %i, 1 46 %i.exitcond = icmp eq i64 %i.inc, %n 47 br i1 %i.exitcond, label %end, label %for.i 48 49end: 50 ret void 51} 52