1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2 3; void foo(int n, int m, int o, double A[n][m][o]) { 4; 5; for (int i = 0; i < n; i++) 6; for (int j = 0; j < m; j++) 7; for (int k = 0; k < o; k++) 8; A[i][j][k] = 1.0; 9; } 10 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) } 15 16; 17; CHECK: p0: %o 18; CHECK-NEXT: p1: %m 19; CHECK-NEXT: p2: %n 20; CHECK-NOT: p3 21; 22; CHECK: Arrays { 23; CHECK-NEXT: double MemRef_A[*][(zext i32 %m to i64)][(zext i32 %o to i64)]; // Element size 8 24; CHECK-NEXT: } 25; 26; CHECK: Arrays (Bounds as pw_affs) { 27; CHECK-NEXT: double MemRef_A[*][ [m] -> { [] -> [(m)] } ][ [o] -> { [] -> [(o)] } ]; // Element size 8 28; CHECK-NEXT: } 29; 30; CHECK: Statements { 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] }; 38; CHECK-NEXT: } 39 40target 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" 41 42define void @foo(i32 %n, i32 %m, i32 %o, double* %A) { 43entry: 44 %m_zext = zext i32 %m to i64 45 %n_zext = zext i32 %o to i64 46 br label %for.i 47 48for.i: 49 %i = phi i64 [ %i.inc, %for.i.inc ], [ 0, %entry ] 50 br label %for.j 51 52for.j: 53 %j = phi i64 [ %j.inc, %for.j.inc ], [ 0, %for.i ] 54 br label %for.k 55 56for.k: 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, double* %A, i64 %subscript 66 store double 1.0, double* %idx 67 br label %for.k.inc 68 69for.k.inc: 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 74 75for.j.inc: 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 80 81for.i.inc: 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 86 87end: 88 ret void 89} 90