source: icGREP/icgrep-devel/llvm-3.8.0.src/test/Analysis/Delinearization/multidim_ivs_and_integer_offsets_3d.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.6 KB
Line 
1; RUN: opt < %s -analyze -delinearize  | FileCheck %s
2
3; void foo(long n, long m, long o, double A[n][m][o]) {
4;
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;
9; }
10
11; AddRec: {{{(56 + (8 * (-4 + (3 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j>,+,8}<%for.k>
12; CHECK: Base offset: %A
13; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of 8 bytes.
14; CHECK: ArrayRef[{3,+,1}<nuw><%for.i>][{-4,+,1}<nw><%for.j>][{7,+,1}<nuw><nsw><%for.k>]
15
16define void @foo(i64 %n, i64 %m, i64 %o, double* %A) {
17entry:
18  br label %for.i
19
20for.i:
21  %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ]
22  br label %for.j
23
24for.j:
25  %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j.inc ]
26  br label %for.k
27
28for.k:
29  %k = phi i64 [ 0, %for.j ], [ %k.inc, %for.k.inc ]
30  %offset0 = add nsw i64 %i, 3
31  %subscript0 = mul i64 %offset0, %m
32  %offset1 = add nsw i64 %j, -4
33  %subscript1 = add i64 %offset1, %subscript0
34  %subscript2 = mul i64 %subscript1, %o
35  %offset2 = add nsw i64 %k, 7
36  %subscript = add i64 %subscript2, %offset2
37  %idx = getelementptr inbounds double, double* %A, i64 %subscript
38  store double 1.0, double* %idx
39  br label %for.k.inc
40
41for.k.inc:
42  %k.inc = add nsw i64 %k, 1
43  %k.exitcond = icmp eq i64 %k.inc, %o
44  br i1 %k.exitcond, label %for.j.inc, label %for.k
45
46for.j.inc:
47  %j.inc = add nsw i64 %j, 1
48  %j.exitcond = icmp eq i64 %j.inc, %m
49  br i1 %j.exitcond, label %for.i.inc, label %for.j
50
51for.i.inc:
52  %i.inc = add nsw i64 %i, 1
53  %i.exitcond = icmp eq i64 %i.inc, %n
54  br i1 %i.exitcond, label %end, label %for.i
55
56end:
57  ret void
58}
Note: See TracBrowser for help on using the repository browser.