1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
3 ; void foo(int n, int m, int o, double A[n][m][o]) {
5 ; for (int i = 0; i < n; i++)
6 ; for (int j = 0; j < m; j++)
7 ; for (int k = 0; k < o; k++)
11 ; CHECK: Assumed Context:
12 ; CHECK-NEXT: [o, m, n] -> { : }
13 ; CHECK-NEXT: Invalid Context:
14 ; CHECK-NEXT: [o, m, n] -> { : o < 0 or m < 0 or n <= 0 or (m <= 0 and n > 0) or (o <= 0 and m > 0 and n > 0) }
23 ; CHECK-NEXT: double MemRef_A[*][(zext i32 %m to i64)][(zext i32 %o to i64)]; // Element size 8
26 ; CHECK: Arrays (Bounds as pw_affs) {
27 ; CHECK-NEXT: double MemRef_A[*][ [m] -> { [] -> [(m)] } ][ [o] -> { [] -> [(o)] } ]; // Element size 8
31 ; CHECK-NEXT: Stmt_for_k
32 ; CHECK-NEXT: Domain :=
33 ; CHECK-NEXT: [o, m, n] -> { Stmt_for_k[i0, i1, i2] : 0 <= i0 < n and 0 <= i1 < m and 0 <= i2 < o };
34 ; CHECK-NEXT: Schedule :=
35 ; CHECK-NEXT: [o, m, n] -> { Stmt_for_k[i0, i1, i2] -> [i0, i1, i2] };
36 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
37 ; CHECK-NEXT: [o, m, n] -> { Stmt_for_k[i0, i1, i2] -> MemRef_A[i0, i1, i2] };
40 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"
42 define void @foo(i32 %n, i32 %m, i32 %o, ptr %A) {
44 %m_zext = zext i32 %m to i64
45 %n_zext = zext i32 %o to i64
49 %i = phi i64 [ %i.inc, %for.i.inc ], [ 0, %entry ]
53 %j = phi i64 [ %j.inc, %for.j.inc ], [ 0, %for.i ]
57 %k = phi i64 [ %k.inc, %for.k.inc ], [ 0, %for.j ]
58 %tmp = mul i64 %i, %m_zext
59 %tmp1 = trunc i64 %j to i32
60 %tmp2 = trunc i64 %i to i32
61 %mul.us.us = mul nsw i32 %tmp1, %tmp2
62 %tmp.us.us = add i64 %j, %tmp
63 %tmp17.us.us = mul i64 %tmp.us.us, %n_zext
64 %subscript = add i64 %tmp17.us.us, %k
65 %idx = getelementptr inbounds double, ptr %A, i64 %subscript
66 store double 1.0, ptr %idx
70 %k.inc = add i64 %k, 1
71 %k.inc.trunc = trunc i64 %k.inc to i32
72 %k.exitcond = icmp eq i32 %k.inc.trunc, %o
73 br i1 %k.exitcond, label %for.j.inc, label %for.k
76 %j.inc = add i64 %j, 1
77 %j.inc.trunc = trunc i64 %j.inc to i32
78 %j.exitcond = icmp eq i32 %j.inc.trunc, %m
79 br i1 %j.exitcond, label %for.i.inc, label %for.j
82 %i.inc = add i64 %i, 1
83 %i.inc.trunc = trunc i64 %i.inc to i32
84 %i.exitcond = icmp eq i32 %i.inc.trunc, %n
85 br i1 %i.exitcond, label %end, label %for.i