1 ; RUN: opt < %s -analyze -delinearize | FileCheck %s
3 ; void foo(long n, long m, long o, long p, double A[n][m][o+p]) {
5 ; for (long i = 0; i < n; i++)
6 ; for (long j = 0; j < m; j++)
7 ; for (long k = 0; k < o; k++)
8 ; A[i+3][j-4][k+7] = 1.0;
11 ; AddRec: {{{(56 + (8 * (-4 + (3 * %m)) * (%o + %p)) + %A),+,(8 * (%o + %p) * %m)}<%for.cond4.preheader.lr.ph.us>,+,(8 * (%o + %p))}<%for.body6.lr.ph.us.us>,+,8}<%for.body6.us.us>
12 ; CHECK: Base offset: %A
13 ; CHECK: ArrayDecl[UnknownSize][%m][(%o + %p)] with elements of 8 bytes.
14 ; CHECK: ArrayRef[{3,+,1}<nuw><%for.cond4.preheader.lr.ph.us>][{-4,+,1}<nw><%for.body6.lr.ph.us.us>][{7,+,1}<nw><%for.body6.us.us>]
16 define void @foo(i64 %n, i64 %m, i64 %o, i64 %p, double* nocapture %A) nounwind uwtable {
18 %add = add nsw i64 %p, %o
19 %cmp22 = icmp sgt i64 %n, 0
20 br i1 %cmp22, label %for.cond1.preheader.lr.ph, label %for.end16
22 for.cond1.preheader.lr.ph: ; preds = %entry
23 %cmp220 = icmp sgt i64 %m, 0
24 %cmp518 = icmp sgt i64 %o, 0
25 br i1 %cmp220, label %for.cond4.preheader.lr.ph.us, label %for.end16
27 for.inc14.us: ; preds = %for.cond4.preheader.lr.ph.us, %for.inc11.us.us
28 %inc15.us = add nsw i64 %i.023.us, 1
29 %exitcond43 = icmp eq i64 %inc15.us, %n
30 br i1 %exitcond43, label %for.end16, label %for.cond4.preheader.lr.ph.us
32 for.cond4.preheader.lr.ph.us: ; preds = %for.inc14.us, %for.cond1.preheader.lr.ph
33 %i.023.us = phi i64 [ %inc15.us, %for.inc14.us ], [ 0, %for.cond1.preheader.lr.ph ]
34 %add8.us = add nsw i64 %i.023.us, 3
35 %0 = mul i64 %add8.us, %m
36 %sub.us = add i64 %0, -4
37 br i1 %cmp518, label %for.body6.lr.ph.us.us, label %for.inc14.us
39 for.inc11.us.us: ; preds = %for.body6.us.us
40 %inc12.us.us = add nsw i64 %j.021.us.us, 1
41 %exitcond42 = icmp eq i64 %inc12.us.us, %m
42 br i1 %exitcond42, label %for.inc14.us, label %for.body6.lr.ph.us.us
44 for.body6.lr.ph.us.us: ; preds = %for.cond4.preheader.lr.ph.us, %for.inc11.us.us
45 %j.021.us.us = phi i64 [ %inc12.us.us, %for.inc11.us.us ], [ 0, %for.cond4.preheader.lr.ph.us ]
46 %tmp.us.us = add i64 %sub.us, %j.021.us.us
47 %tmp17.us.us = mul i64 %tmp.us.us, %add
48 br label %for.body6.us.us
50 for.body6.us.us: ; preds = %for.body6.us.us, %for.body6.lr.ph.us.us
51 %k.019.us.us = phi i64 [ 0, %for.body6.lr.ph.us.us ], [ %inc.us.us, %for.body6.us.us ]
52 %arrayidx.sum.us.us = add i64 %k.019.us.us, 7
53 %arrayidx9.sum.us.us = add i64 %arrayidx.sum.us.us, %tmp17.us.us
54 %arrayidx10.us.us = getelementptr inbounds double, double* %A, i64 %arrayidx9.sum.us.us
55 store double 1.000000e+00, double* %arrayidx10.us.us, align 8
56 %inc.us.us = add nsw i64 %k.019.us.us, 1
57 %exitcond = icmp eq i64 %inc.us.us, %o
58 br i1 %exitcond, label %for.inc11.us.us, label %for.body6.us.us
60 for.end16: ; preds = %for.cond1.preheader.lr.ph, %for.inc14.us, %entry