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
4 ; void foo(long n, long m, long o, long p, double A[n][m][o+p]) {
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+3][j-4][k+7] = 1.0;
12 ; 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>
13 ; CHECK: Base offset: %A
14 ; CHECK: ArrayDecl[UnknownSize][%m][(%o + %p)] with elements of 8 bytes.
15 ; 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>]
17 define void @foo(i64 %n, i64 %m, i64 %o, i64 %p, double* nocapture %A) nounwind uwtable {
19 %add = add nsw i64 %p, %o
20 %cmp22 = icmp sgt i64 %n, 0
21 br i1 %cmp22, label %for.cond1.preheader.lr.ph, label %for.end16
23 for.cond1.preheader.lr.ph: ; preds = %entry
24 %cmp220 = icmp sgt i64 %m, 0
25 %cmp518 = icmp sgt i64 %o, 0
26 br i1 %cmp220, label %for.cond4.preheader.lr.ph.us, label %for.end16
28 for.inc14.us: ; preds = %for.cond4.preheader.lr.ph.us, %for.inc11.us.us
29 %inc15.us = add nsw i64 %i.023.us, 1
30 %exitcond43 = icmp eq i64 %inc15.us, %n
31 br i1 %exitcond43, label %for.end16, label %for.cond4.preheader.lr.ph.us
33 for.cond4.preheader.lr.ph.us: ; preds = %for.inc14.us, %for.cond1.preheader.lr.ph
34 %i.023.us = phi i64 [ %inc15.us, %for.inc14.us ], [ 0, %for.cond1.preheader.lr.ph ]
35 %add8.us = add nsw i64 %i.023.us, 3
36 %0 = mul i64 %add8.us, %m
37 %sub.us = add i64 %0, -4
38 br i1 %cmp518, label %for.body6.lr.ph.us.us, label %for.inc14.us
40 for.inc11.us.us: ; preds = %for.body6.us.us
41 %inc12.us.us = add nsw i64 %j.021.us.us, 1
42 %exitcond42 = icmp eq i64 %inc12.us.us, %m
43 br i1 %exitcond42, label %for.inc14.us, label %for.body6.lr.ph.us.us
45 for.body6.lr.ph.us.us: ; preds = %for.cond4.preheader.lr.ph.us, %for.inc11.us.us
46 %j.021.us.us = phi i64 [ %inc12.us.us, %for.inc11.us.us ], [ 0, %for.cond4.preheader.lr.ph.us ]
47 %tmp.us.us = add i64 %sub.us, %j.021.us.us
48 %tmp17.us.us = mul i64 %tmp.us.us, %add
49 br label %for.body6.us.us
51 for.body6.us.us: ; preds = %for.body6.us.us, %for.body6.lr.ph.us.us
52 %k.019.us.us = phi i64 [ 0, %for.body6.lr.ph.us.us ], [ %inc.us.us, %for.body6.us.us ]
53 %arrayidx.sum.us.us = add i64 %k.019.us.us, 7
54 %arrayidx9.sum.us.us = add i64 %arrayidx.sum.us.us, %tmp17.us.us
55 %arrayidx10.us.us = getelementptr inbounds double, double* %A, i64 %arrayidx9.sum.us.us
56 store double 1.000000e+00, double* %arrayidx10.us.us, align 8
57 %inc.us.us = add nsw i64 %k.019.us.us, 1
58 %exitcond = icmp eq i64 %inc.us.us, %o
59 br i1 %exitcond, label %for.inc11.us.us, label %for.body6.us.us
61 for.end16: ; preds = %for.cond1.preheader.lr.ph, %for.inc14.us, %entry