1 ; RUN: opt < %s -analyze -delinearize | FileCheck %s
3 ; Derived from the following code:
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++)
11 ; Inst: %val = load double, double* %arrayidx
12 ; In Loop with Header: for.j
13 ; AddRec: {{0,+,(%m * 8)}<%for.i>,+,8}<%for.j>
15 ; ArrayDecl[UnknownSize][%m] with elements of 8 bytes.
16 ; ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>]
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>]
25 define void @foo(i64 %n, i64 %m, double* %A) {
30 %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ]
31 %tmp = mul nsw i64 %i, %m
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
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