1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
5 ; void first_higher_dimensional(float A[][N]) {
6 ; for (long i = 0; i < N; i++)
7 ; for (long j = 0; j < N; j++)
10 ; A[0][0] += A[100][100];
12 ; for (long i = 0; i < N; i++)
13 ; for (long j = 0; j < N; j++)
17 ; void first_lower_dimensional(float A[][N], float B[][N]) {
18 ; for (long i = 0; i < N; i++)
19 ; for (long j = 0; j < N; j++)
22 ; A[0][0] += B[100][100];
24 ; for (long i = 0; i < N; i++)
25 ; for (long j = 0; j < N; j++)
30 ; CHECK-NEXT: Stmt_bb7
31 ; CHECK-NEXT: Domain :=
32 ; CHECK-NEXT: { Stmt_bb7[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
33 ; CHECK-NEXT: Schedule :=
34 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> [0, i0, i1] };
35 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
36 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_A[i0, i1] };
37 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
38 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_A[i0, i1] };
39 ; CHECK-NEXT: Stmt_bb17
40 ; CHECK-NEXT: Domain :=
41 ; CHECK-NEXT: { Stmt_bb17[] };
42 ; CHECK-NEXT: Schedule :=
43 ; CHECK-NEXT: { Stmt_bb17[] -> [1, 0, 0] };
44 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
45 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[100, 100] };
46 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
47 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
48 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
49 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
50 ; CHECK-NEXT: Stmt_bb26
51 ; CHECK-NEXT: Domain :=
52 ; CHECK-NEXT: { Stmt_bb26[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
53 ; CHECK-NEXT: Schedule :=
54 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> [2, i0, i1] };
55 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
56 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
57 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
58 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
62 ; CHECK-NEXT: Stmt_bb7
63 ; CHECK-NEXT: Domain :=
64 ; CHECK-NEXT: { Stmt_bb7[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
65 ; CHECK-NEXT: Schedule :=
66 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> [0, i0, i1] };
67 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
68 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_B[i0, i1] };
69 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
70 ; CHECK-NEXT: { Stmt_bb7[i0, i1] -> MemRef_B[i0, i1] };
71 ; CHECK-NEXT: Stmt_bb17
72 ; CHECK-NEXT: Domain :=
73 ; CHECK-NEXT: { Stmt_bb17[] };
74 ; CHECK-NEXT: Schedule :=
75 ; CHECK-NEXT: { Stmt_bb17[] -> [1, 0, 0] };
76 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
77 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_B[100, 100] };
78 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
79 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
80 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
81 ; CHECK-NEXT: { Stmt_bb17[] -> MemRef_A[0, 0] };
82 ; CHECK-NEXT: Stmt_bb26
83 ; CHECK-NEXT: Domain :=
84 ; CHECK-NEXT: { Stmt_bb26[i0, i1] : 0 <= i0 <= 399 and 0 <= i1 <= 399 };
85 ; CHECK-NEXT: Schedule :=
86 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> [2, i0, i1] };
87 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
88 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
89 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
90 ; CHECK-NEXT: { Stmt_bb26[i0, i1] -> MemRef_A[i0, i1] };
93 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
95 define void @first_higher_dimensional(ptr %A) {
99 bb4: ; preds = %bb15, %bb
100 %i.0 = phi i64 [ 0, %bb ], [ %tmp16, %bb15 ]
101 %exitcond3 = icmp ne i64 %i.0, 400
102 br i1 %exitcond3, label %bb5, label %bb17
107 bb6: ; preds = %bb12, %bb5
108 %j.0 = phi i64 [ 0, %bb5 ], [ %tmp13, %bb12 ]
109 %exitcond2 = icmp ne i64 %j.0, 400
110 br i1 %exitcond2, label %bb7, label %bb14
113 %tmp = add nuw nsw i64 %i.0, %j.0
114 %tmp8 = sitofp i64 %tmp to float
115 %tmp9 = getelementptr inbounds [400 x float], ptr %A, i64 %i.0, i64 %j.0
116 %tmp10 = load float, ptr %tmp9, align 4
117 %tmp11 = fadd float %tmp10, %tmp8
118 store float %tmp11, ptr %tmp9, align 4
122 %tmp13 = add nuw nsw i64 %j.0, 1
128 bb15: ; preds = %bb14
129 %tmp16 = add nuw nsw i64 %i.0, 1
133 %tmp18 = getelementptr inbounds [400 x float], ptr %A, i64 100, i64 100
134 %tmp19 = load float, ptr %tmp18, align 4
135 %tmp21 = load float, ptr %A, align 4
136 %tmp22 = fadd float %tmp21, %tmp19
137 store float %tmp22, ptr %A, align 4
140 bb23: ; preds = %bb35, %bb17
141 %i1.0 = phi i64 [ 0, %bb17 ], [ %tmp36, %bb35 ]
142 %exitcond1 = icmp ne i64 %i1.0, 400
143 br i1 %exitcond1, label %bb24, label %bb37
145 bb24: ; preds = %bb23
148 bb25: ; preds = %bb32, %bb24
149 %j2.0 = phi i64 [ 0, %bb24 ], [ %tmp33, %bb32 ]
150 %exitcond = icmp ne i64 %j2.0, 400
151 br i1 %exitcond, label %bb26, label %bb34
153 bb26: ; preds = %bb25
154 %tmp27 = add nuw nsw i64 %i1.0, %j2.0
155 %tmp28 = sitofp i64 %tmp27 to float
156 %tmp29 = getelementptr inbounds [400 x float], ptr %A, i64 %i1.0, i64 %j2.0
157 %tmp30 = load float, ptr %tmp29, align 4
158 %tmp31 = fadd float %tmp30, %tmp28
159 store float %tmp31, ptr %tmp29, align 4
162 bb32: ; preds = %bb26
163 %tmp33 = add nuw nsw i64 %j2.0, 1
166 bb34: ; preds = %bb25
169 bb35: ; preds = %bb34
170 %tmp36 = add nuw nsw i64 %i1.0, 1
173 bb37: ; preds = %bb23
177 define void @first_lower_dimensional(ptr %A, ptr %B) {
181 bb4: ; preds = %bb15, %bb
182 %i.0 = phi i64 [ 0, %bb ], [ %tmp16, %bb15 ]
183 %exitcond3 = icmp ne i64 %i.0, 400
184 br i1 %exitcond3, label %bb5, label %bb17
189 bb6: ; preds = %bb12, %bb5
190 %j.0 = phi i64 [ 0, %bb5 ], [ %tmp13, %bb12 ]
191 %exitcond2 = icmp ne i64 %j.0, 400
192 br i1 %exitcond2, label %bb7, label %bb14
195 %tmp = add nuw nsw i64 %i.0, %j.0
196 %tmp8 = sitofp i64 %tmp to float
197 %tmp9 = getelementptr inbounds [400 x float], ptr %B, i64 %i.0, i64 %j.0
198 %tmp10 = load float, ptr %tmp9, align 4
199 %tmp11 = fadd float %tmp10, %tmp8
200 store float %tmp11, ptr %tmp9, align 4
204 %tmp13 = add nuw nsw i64 %j.0, 1
210 bb15: ; preds = %bb14
211 %tmp16 = add nuw nsw i64 %i.0, 1
215 %tmp18 = getelementptr inbounds [400 x float], ptr %B, i64 100, i64 100
216 %tmp19 = load float, ptr %tmp18, align 4
217 %tmp21 = load float, ptr %A, align 4
218 %tmp22 = fadd float %tmp21, %tmp19
219 store float %tmp22, ptr %A, align 4
222 bb23: ; preds = %bb35, %bb17
223 %i1.0 = phi i64 [ 0, %bb17 ], [ %tmp36, %bb35 ]
224 %exitcond1 = icmp ne i64 %i1.0, 400
225 br i1 %exitcond1, label %bb24, label %bb37
227 bb24: ; preds = %bb23
230 bb25: ; preds = %bb32, %bb24
231 %j2.0 = phi i64 [ 0, %bb24 ], [ %tmp33, %bb32 ]
232 %exitcond = icmp ne i64 %j2.0, 400
233 br i1 %exitcond, label %bb26, label %bb34
235 bb26: ; preds = %bb25
236 %tmp27 = add nuw nsw i64 %i1.0, %j2.0
237 %tmp28 = sitofp i64 %tmp27 to float
238 %tmp29 = getelementptr inbounds [400 x float], ptr %A, i64 %i1.0, i64 %j2.0
239 %tmp30 = load float, ptr %tmp29, align 4
240 %tmp31 = fadd float %tmp30, %tmp28
241 store float %tmp31, ptr %tmp29, align 4
244 bb32: ; preds = %bb26
245 %tmp33 = add nuw nsw i64 %j2.0, 1
248 bb34: ; preds = %bb25
251 bb35: ; preds = %bb34
252 %tmp36 = add nuw nsw i64 %i1.0, 1
255 bb37: ; preds = %bb23