1; RUN: opt %loadPolly -analyze -polly-scops -S < %s | FileCheck %s
2;
3;    void foo(long n, float A[][n][n]) {
4;      for (long i = 0; i < 200; i++)
5;        for (long j = 0; j < n; j++)
6;          for (long k = 0; k < n; k++)
7;            A[i % 2][j][k] += 10;
8;    }
9
10; CHECK:      Statements {
11; CHECK-NEXT:     Stmt_for_body_8
12; CHECK-NEXT:         Domain :=
13; CHECK-NEXT:             [n] -> { Stmt_for_body_8[i0, i1, i2] : 0 <= i0 <= 199 and 0 <= i1 < n and 0 <= i2 < n };
14; CHECK-NEXT:         Schedule :=
15; CHECK-NEXT:             [n] -> { Stmt_for_body_8[i0, i1, i2] -> [i0, i1, i2] };
16; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
17; CHECK-NEXT:             [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[1, i1, i2] : (1 + i0) mod 2 = 0; Stmt_for_body_8[i0, i1, i2] -> MemRef_A[0, i1, i2] : (i0) mod 2 = 0 };
18; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
19; CHECK-NEXT:             [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[1, i1, i2] : (1 + i0) mod 2 = 0; Stmt_for_body_8[i0, i1, i2] -> MemRef_A[0, i1, i2] : (i0) mod 2 = 0 };
20; CHECK-NEXT: }
21
22
23target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24
25
26define void @foo(i64 %n, float* %A) #0 {
27entry:
28  br label %entry.split
29
30entry.split:                                      ; preds = %entry
31  br label %for.cond.1.preheader
32
33for.cond.1.preheader:                             ; preds = %entry.split, %for.inc.14
34  %i.06 = phi i64 [ 0, %entry.split ], [ %inc15, %for.inc.14 ]
35  %cmp2.3 = icmp sgt i64 %n, 0
36  br i1 %cmp2.3, label %for.cond.5.preheader.lr.ph, label %for.inc.14
37
38for.cond.5.preheader.lr.ph:                       ; preds = %for.cond.1.preheader
39  br label %for.cond.5.preheader
40
41for.cond.5.preheader:                             ; preds = %for.cond.5.preheader.lr.ph, %for.inc.11
42  %j.04 = phi i64 [ 0, %for.cond.5.preheader.lr.ph ], [ %inc12, %for.inc.11 ]
43  %cmp6.1 = icmp sgt i64 %n, 0
44  br i1 %cmp6.1, label %for.body.8.lr.ph, label %for.inc.11
45
46for.body.8.lr.ph:                                 ; preds = %for.cond.5.preheader
47  br label %for.body.8
48
49for.body.8:                                       ; preds = %for.body.8.lr.ph, %for.body.8
50  %k.02 = phi i64 [ 0, %for.body.8.lr.ph ], [ %inc, %for.body.8 ]
51  %rem = srem i64 %i.06, 2
52  %0 = mul nuw i64 %n, %n
53  %1 = mul nsw i64 %0, %rem
54  %arrayidx = getelementptr inbounds float, float* %A, i64 %1
55  %2 = mul nsw i64 %j.04, %n
56  %arrayidx9 = getelementptr inbounds float, float* %arrayidx, i64 %2
57  %arrayidx10 = getelementptr inbounds float, float* %arrayidx9, i64 %k.02
58  %3 = load float, float* %arrayidx10, align 4, !tbaa !1
59  %add = fadd float %3, 1.000000e+01
60  store float %add, float* %arrayidx10, align 4, !tbaa !1
61  %inc = add nuw nsw i64 %k.02, 1
62  %exitcond = icmp ne i64 %inc, %n
63  br i1 %exitcond, label %for.body.8, label %for.cond.5.for.inc.11_crit_edge
64
65for.cond.5.for.inc.11_crit_edge:                  ; preds = %for.body.8
66  br label %for.inc.11
67
68for.inc.11:                                       ; preds = %for.cond.5.for.inc.11_crit_edge, %for.cond.5.preheader
69  %inc12 = add nuw nsw i64 %j.04, 1
70  %exitcond7 = icmp ne i64 %inc12, %n
71  br i1 %exitcond7, label %for.cond.5.preheader, label %for.cond.1.for.inc.14_crit_edge
72
73for.cond.1.for.inc.14_crit_edge:                  ; preds = %for.inc.11
74  br label %for.inc.14
75
76for.inc.14:                                       ; preds = %for.cond.1.for.inc.14_crit_edge, %for.cond.1.preheader
77  %inc15 = add nuw nsw i64 %i.06, 1
78  %exitcond8 = icmp ne i64 %inc15, 200
79  br i1 %exitcond8, label %for.cond.1.preheader, label %for.end.16
80
81for.end.16:                                       ; preds = %for.inc.14
82  ret void
83}
84
85; Function Attrs: nounwind
86declare void @llvm.lifetime.start(i64, i8* nocapture) #1
87
88; Function Attrs: nounwind
89declare void @llvm.lifetime.end(i64, i8* nocapture) #1
90
91attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
92attributes #1 = { nounwind }
93
94!llvm.ident = !{!0}
95
96!0 = !{!"clang version 3.7.0 (trunk 240923) (llvm/trunk 240924)"}
97!1 = !{!2, !2, i64 0}
98!2 = !{!"float", !3, i64 0}
99!3 = !{!"omnipotent char", !4, i64 0}
100!4 = !{!"Simple C/C++ TBAA"}
101