1 ; RUN: opt %loadPolly -polly-scops -analyze < %s \
2 ; RUN: -polly-precise-fold-accesses | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
5 ; void foo(long n, long m, long o, double A[n][m][o], long p, long q, long r) {
7 ; for (long i = 0; i < n; i++)
8 ; for (long j = 0; j < m; j++)
9 ; for (long k = 0; k < o; k++)
10 ; A[i+p][j+q][k+r] = 1.0;
14 ; {{{((8 * ((((%m * %p) + %q) * %o) + %r)) + %A),+,(8 * %m * %o)}<%for.i>,+,
15 ; (8 * %o)}<%for.j>,+,8}<%for.k>
17 ; CHECK: Assumed Context:
18 ; CHECK-NEXT: [o, m, n, p, q, r] -> { : -m <= q <= 1 and ((-m < q <= 0 and -o < r < 0) or (r = 0 and q <= 0) or (r = -o and q > -m)) }
29 ; CHECK-NEXT: Stmt_for_k
30 ; CHECK-NEXT: Domain :=
31 ; CHECK-NEXT: [o, m, n, p, q, r] -> { Stmt_for_k[i0, i1, i2] : 0 <= i0 < n and 0 <= i1 < m and 0 <= i2 < o };
32 ; CHECK-NEXT: Schedule :=
33 ; CHECK-NEXT: [o, m, n, p, q, r] -> { Stmt_for_k[i0, i1, i2] -> [i0, i1, i2] };
34 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
35 ; CHECK-NEXT: [o, m, n, p, q, r] -> { Stmt_for_k[i0, i1, i2] -> MemRef_A[-1 + p + i0, -1 + m + q + i1, o + r + i2] : i1 <= -q and i2 < -r; Stmt_for_k[i0, i1, i2] -> MemRef_A[p + i0, -1 + q + i1, o + r + i2] : i1 > -q and i2 < -r; Stmt_for_k[i0, i1, i2] -> MemRef_A[-1 + p + i0, m + q + i1, r + i2] : i1 < -q and i2 >= -r; Stmt_for_k[i0, i1, i2] -> MemRef_A[p + i0, q + i1, r + i2] : i1 >= -q and i2 >= -r };
38 define void @foo(i64 %n, i64 %m, i64 %o, double* %A, i64 %p, i64 %q, i64 %r) {
43 %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ]
47 %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j.inc ]
51 %k = phi i64 [ 0, %for.j ], [ %k.inc, %for.k.inc ]
52 %offset0 = add nsw i64 %i, %p
53 %subscript0 = mul i64 %offset0, %m
54 %offset1 = add nsw i64 %j, %q
55 %subscript1 = add i64 %offset1, %subscript0
56 %subscript2 = mul i64 %subscript1, %o
57 %offset2 = add nsw i64 %k, %r
58 %subscript = add i64 %subscript2, %offset2
59 %idx = getelementptr inbounds double, double* %A, i64 %subscript
60 store double 1.0, double* %idx
64 %k.inc = add nsw i64 %k, 1
65 %k.exitcond = icmp eq i64 %k.inc, %o
66 br i1 %k.exitcond, label %for.j.inc, label %for.k
69 %j.inc = add nsw i64 %j, 1
70 %j.exitcond = icmp eq i64 %j.inc, %m
71 br i1 %j.exitcond, label %for.i.inc, label %for.j
74 %i.inc = add nsw i64 %i, 1
75 %i.exitcond = icmp eq i64 %i.inc, %n
76 br i1 %i.exitcond, label %end, label %for.i