1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
3 ; void foo(long n, long m, long o, double A[n][m][o]) {
4 ; for (long i = 0; i < n-3; i++)
5 ; for (long j = 4; j < m; j++)
6 ; for (long k = 0; k < o-7; k++) {
7 ; A[i+3][j-4][k+7] = 1.0;
14 ; CHECK: double MemRef_A[*][%m][%o]; // Element size 8
17 ; CHECK: [m, o, n] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[3 + i0, i1, 7 + i2] };
18 ; CHECK: [m, o, n] -> { Stmt_for_body6[i0, i1, i2] -> MemRef_A[i0, 0, i2] };
20 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22 ; Function Attrs: nounwind uwtable
23 define void @foo(i64 %n, i64 %m, i64 %o, ptr nocapture %A) {
25 %cmp35 = icmp sgt i64 %n, 0
26 br i1 %cmp35, label %for.cond1.preheader.lr.ph, label %for.end18
28 for.cond1.preheader.lr.ph: ; preds = %entry
29 %cmp233 = icmp sgt i64 %m, 0
30 %cmp531 = icmp sgt i64 %o, 0
31 %0 = mul nuw i64 %o, %m
32 br label %for.cond1.preheader
34 for.cond1.preheader: ; preds = %for.inc16, %for.cond1.preheader.lr.ph
35 %i.036 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %inc17, %for.inc16 ]
36 br i1 %cmp233, label %for.cond4.preheader.lr.ph, label %for.inc16
38 for.cond4.preheader.lr.ph: ; preds = %for.cond1.preheader
39 %add7 = add nsw i64 %i.036, 3
40 %1 = mul nsw i64 %add7, %0
42 %2 = mul nsw i64 %i.036, %0
43 br label %for.cond4.preheader
45 for.cond4.preheader: ; preds = %for.inc13, %for.cond4.preheader.lr.ph
46 %j.034 = phi i64 [ 4, %for.cond4.preheader.lr.ph ], [ %inc14, %for.inc13 ]
47 br i1 %cmp531, label %for.body6.lr.ph, label %for.inc13
49 for.body6.lr.ph: ; preds = %for.cond4.preheader
50 %sub = add nsw i64 %j.034, -4
51 %3 = mul nsw i64 %sub, %o
52 %arrayidx.sum = add i64 %add, %3
55 for.body6: ; preds = %for.body6, %for.body6.lr.ph
56 %k.032 = phi i64 [ 0, %for.body6.lr.ph ], [ %inc, %for.body6 ]
57 %arrayidx8.sum = add i64 %arrayidx.sum, %k.032
58 %arrayidx9 = getelementptr inbounds double, ptr %A, i64 %arrayidx8.sum
59 store double 1.000000e+00, ptr %arrayidx9, align 8
60 %arrayidx10.sum = add i64 %k.032, %2
61 %arrayidx12 = getelementptr inbounds double, ptr %A, i64 %arrayidx10.sum
62 store double 2.000000e+00, ptr %arrayidx12, align 8
63 %inc = add nsw i64 %k.032, 1
64 %osub = sub nsw i64 %o, 7
65 %exitcond = icmp eq i64 %inc, %osub
66 br i1 %exitcond, label %for.inc13, label %for.body6
68 for.inc13: ; preds = %for.body6, %for.cond4.preheader
69 %inc14 = add nsw i64 %j.034, 1
70 %exitcond37 = icmp eq i64 %inc14, %m
71 br i1 %exitcond37, label %for.inc16, label %for.cond4.preheader
73 for.inc16: ; preds = %for.inc13, %for.cond1.preheader
74 %inc17 = add nsw i64 %i.036, 1
75 %nsub = sub nsw i64 %n, 3
76 %exitcond38 = icmp eq i64 %inc17, %nsub
77 br i1 %exitcond38, label %for.end18, label %for.cond1.preheader
79 for.end18: ; preds = %for.inc16, %entry