1 ; RUN: opt %loadPolly -polly-detect -stats -disable-output < %s 2>&1 | FileCheck %s
5 ; CHECK-DAG: 4 polly-detect - Maximal number of loops in scops (profitable scops only)
6 ; CHECK-DAG: 4 polly-detect - Maximal number of loops in scops
7 ; CHECK-DAG: 11 polly-detect - Number of loops in scops (profitable scops only)
8 ; CHECK-DAG: 11 polly-detect - Number of loops in scops
9 ; CHECK-DAG: 11 polly-detect - Number of total loops
10 ; CHECK-DAG: 6 polly-detect - Number of scops (profitable scops only)
11 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4 (profitable scops only)
12 ; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1 (profitable scops only)
13 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3 (profitable scops only)
14 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2 (profitable scops only)
15 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 0 (profitable scops only)
16 ; CHECK-DAG: 6 polly-detect - Number of scops
17 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4
18 ; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1
19 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3
20 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2
21 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 0
23 ; void foo_0d(float *A) {
28 ; void foo_1d(float *A) {
29 ; for (long i = 0; i < 1024; i++)
33 ; void foo_2d(float *A) {
34 ; for (long i = 0; i < 1024; i++)
35 ; for (long j = 0; j < 1024; j++)
39 ; void foo_3d(float *A) {
40 ; for (long i = 0; i < 1024; i++)
41 ; for (long j = 0; j < 1024; j++)
42 ; for (long k = 0; k < 1024; k++)
43 ; A[i + j + k] += i + j + k;
46 ; void foo_4d(float *A) {
47 ; for (long i = 0; i < 1024; i++)
48 ; for (long j = 0; j < 1024; j++)
49 ; for (long k = 0; k < 1024; k++)
50 ; for (long l = 0; l < 1024; l++)
51 ; A[i + j + k + l] += i + j + k + l;
54 ; void foo_zero_iterations(float *S) {
55 ; for (long i = 0; i < 0; i++)
58 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
60 define void @foo_0d(ptr %A) {
65 br i1 true, label %exit, label %block
68 store float 42.0, ptr %A
75 define void @foo_1d(ptr %A) {
79 bb1: ; preds = %bb6, %bb
80 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
81 %exitcond = icmp ne i64 %i.0, 1024
82 br i1 %exitcond, label %bb2, label %bb8
85 %tmp = sitofp i64 %i.0 to float
86 %tmp3 = getelementptr inbounds float, ptr %A, i64 %i.0
87 %tmp4 = load float, ptr %tmp3, align 4
88 %tmp5 = fadd float %tmp4, %tmp
89 store float %tmp5, ptr %tmp3, align 4
93 %tmp7 = add nuw nsw i64 %i.0, 1
100 define void @foo_2d(ptr %A) {
104 bb2: ; preds = %bb14, %bb
105 %i.0 = phi i64 [ 0, %bb ], [ %tmp15, %bb14 ]
106 %exitcond1 = icmp ne i64 %i.0, 1024
107 br i1 %exitcond1, label %bb3, label %bb16
112 bb4: ; preds = %bb11, %bb3
113 %j.0 = phi i64 [ 0, %bb3 ], [ %tmp12, %bb11 ]
114 %exitcond = icmp ne i64 %j.0, 1024
115 br i1 %exitcond, label %bb5, label %bb13
118 %tmp = add nuw nsw i64 %i.0, %j.0
119 %tmp6 = sitofp i64 %tmp to float
120 %tmp7 = add nuw nsw i64 %i.0, %j.0
121 %tmp8 = getelementptr inbounds float, ptr %A, i64 %tmp7
122 %tmp9 = load float, ptr %tmp8, align 4
123 %tmp10 = fadd float %tmp9, %tmp6
124 store float %tmp10, ptr %tmp8, align 4
128 %tmp12 = add nuw nsw i64 %j.0, 1
134 bb14: ; preds = %bb13
135 %tmp15 = add nuw nsw i64 %i.0, 1
142 define void @foo_3d(ptr %A) {
146 bb3: ; preds = %bb22, %bb
147 %i.0 = phi i64 [ 0, %bb ], [ %tmp23, %bb22 ]
148 %exitcond2 = icmp ne i64 %i.0, 1024
149 br i1 %exitcond2, label %bb4, label %bb24
154 bb5: ; preds = %bb19, %bb4
155 %j.0 = phi i64 [ 0, %bb4 ], [ %tmp20, %bb19 ]
156 %exitcond1 = icmp ne i64 %j.0, 1024
157 br i1 %exitcond1, label %bb6, label %bb21
162 bb7: ; preds = %bb16, %bb6
163 %k.0 = phi i64 [ 0, %bb6 ], [ %tmp17, %bb16 ]
164 %exitcond = icmp ne i64 %k.0, 1024
165 br i1 %exitcond, label %bb8, label %bb18
168 %tmp = add nuw nsw i64 %i.0, %j.0
169 %tmp9 = add nuw nsw i64 %tmp, %k.0
170 %tmp10 = sitofp i64 %tmp9 to float
171 %tmp11 = add nuw nsw i64 %i.0, %j.0
172 %tmp12 = add nuw nsw i64 %tmp11, %k.0
173 %tmp13 = getelementptr inbounds float, ptr %A, i64 %tmp12
174 %tmp14 = load float, ptr %tmp13, align 4
175 %tmp15 = fadd float %tmp14, %tmp10
176 store float %tmp15, ptr %tmp13, align 4
180 %tmp17 = add nuw nsw i64 %k.0, 1
186 bb19: ; preds = %bb18
187 %tmp20 = add nuw nsw i64 %j.0, 1
193 bb22: ; preds = %bb21
194 %tmp23 = add nuw nsw i64 %i.0, 1
201 define void @foo_4d(ptr %A) {
205 bb4: ; preds = %bb30, %bb
206 %i.0 = phi i64 [ 0, %bb ], [ %tmp31, %bb30 ]
207 %exitcond3 = icmp ne i64 %i.0, 1024
208 br i1 %exitcond3, label %bb5, label %bb32
213 bb6: ; preds = %bb27, %bb5
214 %j.0 = phi i64 [ 0, %bb5 ], [ %tmp28, %bb27 ]
215 %exitcond2 = icmp ne i64 %j.0, 1024
216 br i1 %exitcond2, label %bb7, label %bb29
221 bb8: ; preds = %bb24, %bb7
222 %k.0 = phi i64 [ 0, %bb7 ], [ %tmp25, %bb24 ]
223 %exitcond1 = icmp ne i64 %k.0, 1024
224 br i1 %exitcond1, label %bb9, label %bb26
229 bb10: ; preds = %bb21, %bb9
230 %l.0 = phi i64 [ 0, %bb9 ], [ %tmp22, %bb21 ]
231 %exitcond = icmp ne i64 %l.0, 1024
232 br i1 %exitcond, label %bb11, label %bb23
234 bb11: ; preds = %bb10
235 %tmp = add nuw nsw i64 %i.0, %j.0
236 %tmp12 = add nuw nsw i64 %tmp, %k.0
237 %tmp13 = add nuw nsw i64 %tmp12, %l.0
238 %tmp14 = sitofp i64 %tmp13 to float
239 %tmp15 = add nuw nsw i64 %i.0, %j.0
240 %tmp16 = add nuw nsw i64 %tmp15, %k.0
241 %tmp17 = add nuw nsw i64 %tmp16, %l.0
242 %tmp18 = getelementptr inbounds float, ptr %A, i64 %tmp17
243 %tmp19 = load float, ptr %tmp18, align 4
244 %tmp20 = fadd float %tmp19, %tmp14
245 store float %tmp20, ptr %tmp18, align 4
248 bb21: ; preds = %bb11
249 %tmp22 = add nuw nsw i64 %l.0, 1
252 bb23: ; preds = %bb10
255 bb24: ; preds = %bb23
256 %tmp25 = add nuw nsw i64 %k.0, 1
262 bb27: ; preds = %bb26
263 %tmp28 = add nuw nsw i64 %j.0, 1
269 bb30: ; preds = %bb29
270 %tmp31 = add nuw nsw i64 %i.0, 1
277 define void @foo_zero_iterations(ptr %A) {
281 bb1: ; preds = %bb6, %bb
282 %i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
283 %exitcond = icmp ne i64 %i.0, 0
284 br i1 %exitcond, label %bb2, label %bb8
287 %tmp = sitofp i64 %i.0 to float
288 %tmp3 = getelementptr inbounds float, ptr %A, i64 %i.0
289 %tmp4 = load float, ptr %tmp3, align 4
290 %tmp5 = fadd float %tmp4, %tmp
291 store float %tmp5, ptr %tmp3, align 4
295 %tmp7 = add nuw nsw i64 %i.0, 1