1 ; RUN: opt %loadNPMPolly -passes=polly-opt-isl -stats -disable-output < %s 2>&1 | FileCheck %s -match-full-lines
5 ; void foo_1d(float *A) {
6 ; for (long i = 0; i < 1024; i++)
10 ; void foo_2d(float *A) {
11 ; for (long i = 0; i < 1024; i++)
12 ; for (long j = 0; j < 1024; j++)
16 ; void foo_3d(float *A) {
17 ; for (long i = 0; i < 1024; i++)
18 ; for (long j = 0; j < 1024; j++)
19 ; for (long k = 0; k < 1024; k++)
20 ; A[i + j + k] += i + j + k;
23 ; void foo_4d(float *A) {
24 ; for (long i = 0; i < 1024; i++)
25 ; for (long j = 0; j < 1024; j++)
26 ; for (long k = 0; k < 1024; k++)
27 ; for (long l = 0; l < 1024; l++)
28 ; A[i + j + k + l] += i + j + k + l;
31 ; void foo_zero_iterations(float *S) {
32 ; for (long i = 0; i < 0; i++)
35 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
37 define void @foo_1d(ptr %A) {
41 bb1: ; preds = %bb6, %bb
42 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
43 %exitcond = icmp ne i64 %i.0, 1024
44 br i1 %exitcond, label %bb2, label %bb8
47 %tmp = sitofp i64 %i.0 to float
48 %tmp3 = getelementptr inbounds float, ptr %A, i64 %i.0
49 %tmp4 = load float, ptr %tmp3, align 4
50 %tmp5 = fadd float %tmp4, %tmp
51 store float %tmp5, ptr %tmp3, align 4
55 %tmp7 = add nuw nsw i64 %i.0, 1
62 define void @foo_2d(ptr %A) {
66 bb2: ; preds = %bb14, %bb
67 %i.0 = phi i64 [ 0, %bb ], [ %tmp15, %bb14 ]
68 %exitcond1 = icmp ne i64 %i.0, 1024
69 br i1 %exitcond1, label %bb3, label %bb16
74 bb4: ; preds = %bb11, %bb3
75 %j.0 = phi i64 [ 0, %bb3 ], [ %tmp12, %bb11 ]
76 %exitcond = icmp ne i64 %j.0, 1024
77 br i1 %exitcond, label %bb5, label %bb13
80 %tmp = add nuw nsw i64 %i.0, %j.0
81 %tmp6 = sitofp i64 %tmp to float
82 %tmp7 = add nuw nsw i64 %i.0, %j.0
83 %tmp8 = getelementptr inbounds float, ptr %A, i64 %tmp7
84 %tmp9 = load float, ptr %tmp8, align 4
85 %tmp10 = fadd float %tmp9, %tmp6
86 store float %tmp10, ptr %tmp8, align 4
90 %tmp12 = add nuw nsw i64 %j.0, 1
97 %tmp15 = add nuw nsw i64 %i.0, 1
104 define void @foo_3d(ptr %A) {
108 bb3: ; preds = %bb22, %bb
109 %i.0 = phi i64 [ 0, %bb ], [ %tmp23, %bb22 ]
110 %exitcond2 = icmp ne i64 %i.0, 1024
111 br i1 %exitcond2, label %bb4, label %bb24
116 bb5: ; preds = %bb19, %bb4
117 %j.0 = phi i64 [ 0, %bb4 ], [ %tmp20, %bb19 ]
118 %exitcond1 = icmp ne i64 %j.0, 1024
119 br i1 %exitcond1, label %bb6, label %bb21
124 bb7: ; preds = %bb16, %bb6
125 %k.0 = phi i64 [ 0, %bb6 ], [ %tmp17, %bb16 ]
126 %exitcond = icmp ne i64 %k.0, 1024
127 br i1 %exitcond, label %bb8, label %bb18
130 %tmp = add nuw nsw i64 %i.0, %j.0
131 %tmp9 = add nuw nsw i64 %tmp, %k.0
132 %tmp10 = sitofp i64 %tmp9 to float
133 %tmp11 = add nuw nsw i64 %i.0, %j.0
134 %tmp12 = add nuw nsw i64 %tmp11, %k.0
135 %tmp13 = getelementptr inbounds float, ptr %A, i64 %tmp12
136 %tmp14 = load float, ptr %tmp13, align 4
137 %tmp15 = fadd float %tmp14, %tmp10
138 store float %tmp15, ptr %tmp13, align 4
142 %tmp17 = add nuw nsw i64 %k.0, 1
148 bb19: ; preds = %bb18
149 %tmp20 = add nuw nsw i64 %j.0, 1
155 bb22: ; preds = %bb21
156 %tmp23 = add nuw nsw i64 %i.0, 1
163 define void @foo_4d(ptr %A) {
167 bb4: ; preds = %bb30, %bb
168 %i.0 = phi i64 [ 0, %bb ], [ %tmp31, %bb30 ]
169 %exitcond3 = icmp ne i64 %i.0, 1024
170 br i1 %exitcond3, label %bb5, label %bb32
175 bb6: ; preds = %bb27, %bb5
176 %j.0 = phi i64 [ 0, %bb5 ], [ %tmp28, %bb27 ]
177 %exitcond2 = icmp ne i64 %j.0, 1024
178 br i1 %exitcond2, label %bb7, label %bb29
183 bb8: ; preds = %bb24, %bb7
184 %k.0 = phi i64 [ 0, %bb7 ], [ %tmp25, %bb24 ]
185 %exitcond1 = icmp ne i64 %k.0, 1024
186 br i1 %exitcond1, label %bb9, label %bb26
191 bb10: ; preds = %bb21, %bb9
192 %l.0 = phi i64 [ 0, %bb9 ], [ %tmp22, %bb21 ]
193 %exitcond = icmp ne i64 %l.0, 1024
194 br i1 %exitcond, label %bb11, label %bb23
196 bb11: ; preds = %bb10
197 %tmp = add nuw nsw i64 %i.0, %j.0
198 %tmp12 = add nuw nsw i64 %tmp, %k.0
199 %tmp13 = add nuw nsw i64 %tmp12, %l.0
200 %tmp14 = sitofp i64 %tmp13 to float
201 %tmp15 = add nuw nsw i64 %i.0, %j.0
202 %tmp16 = add nuw nsw i64 %tmp15, %k.0
203 %tmp17 = add nuw nsw i64 %tmp16, %l.0
204 %tmp18 = getelementptr inbounds float, ptr %A, i64 %tmp17
205 %tmp19 = load float, ptr %tmp18, align 4
206 %tmp20 = fadd float %tmp19, %tmp14
207 store float %tmp20, ptr %tmp18, align 4
210 bb21: ; preds = %bb11
211 %tmp22 = add nuw nsw i64 %l.0, 1
214 bb23: ; preds = %bb10
217 bb24: ; preds = %bb23
218 %tmp25 = add nuw nsw i64 %k.0, 1
224 bb27: ; preds = %bb26
225 %tmp28 = add nuw nsw i64 %j.0, 1
231 bb30: ; preds = %bb29
232 %tmp31 = add nuw nsw i64 %i.0, 1
239 define void @foo_zero_iterations(ptr %A) {
243 bb1: ; preds = %bb6, %bb
244 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
245 %exitcond = icmp ne i64 %i.0, 0
246 br i1 %exitcond, label %bb2, label %bb8
249 %tmp = sitofp i64 %i.0 to float
250 %tmp3 = getelementptr inbounds float, ptr %A, i64 %i.0
251 %tmp4 = load float, ptr %tmp3, align 4
252 %tmp5 = fadd float %tmp4, %tmp
253 store float %tmp5, ptr %tmp3, align 4
257 %tmp7 = add nuw nsw i64 %i.0, 1
265 ; CHECK-DAG: 1 polly-opt-isl - Number of first level tiling applied
266 ; CHECK-DAG: 9 polly-opt-isl - Number of affine loops optimized
267 ; CHECK-DAG: 10 polly-opt-isl - Number of band members (original)
268 ; CHECK-DAG: 10 polly-opt-isl - Number of band members (after scheduler)
269 ; CHECK-DAG: 12 polly-opt-isl - Number of band members (after optimizer)
270 ; CHECK-DAG: 10 polly-opt-isl - Number of bands (original)
271 ; CHECK-DAG: 7 polly-opt-isl - Number of bands (after scheduler)
272 ; CHECK-DAG: 8 polly-opt-isl - Number of bands (after optimizer)
273 ; CHECK-DAG: 4 polly-opt-isl - Number of coincident band members (after scheduler)
274 ; CHECK-DAG: 5 polly-opt-isl - Number of coincident band members (after optimizer)
275 ; CHECK-DAG: 7 polly-opt-isl - Number of permutable bands (after scheduler)
276 ; CHECK-DAG: 8 polly-opt-isl - Number of permutable bands (after optimizer)
277 ; CHECK-DAG: 3 polly-opt-isl - Number of scops optimized
278 ; CHECK-DAG: 4 polly-opt-isl - Number of scops processed
279 ; CHECK-DAG: 4 polly-opt-isl - Number of scops rescheduled