Mercurial > hg > CbC > CbC_llvm
comparison test/Transforms/LoopUnroll/unroll-pragmas.ll @ 147:c2174574ed3a
LLVM 10
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 16:55:33 +0900 |
parents | 803732b1fca8 |
children |
comparison
equal
deleted
inserted
replaced
134:3a76565eade5 | 147:c2174574ed3a |
---|---|
1 ; RUN: opt < %s -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck %s | 1 ; RUN: opt < %s -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s |
2 ; RUN: opt < %s -loop-unroll -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck %s | 2 ; RUN: opt < %s -loop-unroll -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s |
3 ; RUN: opt < %s -loop-unroll -unroll-allow-remainder=0 -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,NOREM %s | |
3 ; | 4 ; |
4 ; Run loop unrolling twice to verify that loop unrolling metadata is properly | 5 ; Run loop unrolling twice to verify that loop unrolling metadata is properly |
5 ; removed and further unrolling is disabled after the pass is run once. | 6 ; removed and further unrolling is disabled after the pass is run once. |
6 | 7 |
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | 8 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
166 } | 167 } |
167 !8 = !{!8, !4} | 168 !8 = !{!8, !4} |
168 | 169 |
169 ; #pragma clang loop unroll_count(4) | 170 ; #pragma clang loop unroll_count(4) |
170 ; Loop has a runtime trip count. Runtime unrolling should occur and loop | 171 ; Loop has a runtime trip count. Runtime unrolling should occur and loop |
171 ; should be duplicated (original and 4x unrolled). | 172 ; should be duplicated (original and 4x unrolled) if remainder is allowed, |
173 ; otherwise loop should not be unrolled. | |
172 ; | 174 ; |
173 ; CHECK-LABEL: @runtime_loop_with_count4( | 175 ; CHECK-LABEL: @runtime_loop_with_count4( |
174 ; CHECK: for.body | 176 ; CHECK: for.body |
175 ; CHECK: store | 177 ; CHECK: store |
176 ; CHECK: store | 178 ; REM: store |
177 ; CHECK: store | 179 ; REM: store |
178 ; CHECK: store | 180 ; REM: store |
179 ; CHECK-NOT: store | 181 ; CHECK-NOT: store |
180 ; CHECK: br i1 | 182 ; CHECK: br i1 |
181 ; CHECK: for.body.epil: | 183 ; REM: for.body.epil: |
182 ; CHECK: store | 184 ; REM: store |
183 ; CHECK-NOT: store | 185 ; NOREM-NOT: for.body.epil: |
184 ; CHECK: br i1 | 186 ; NOREM-NOT: store |
187 ; CHECK-NOT: store | |
188 ; REM: br i1 | |
189 ; NOREM-NOT: br i1 | |
185 define void @runtime_loop_with_count4(i32* nocapture %a, i32 %b) { | 190 define void @runtime_loop_with_count4(i32* nocapture %a, i32 %b) { |
186 entry: | 191 entry: |
187 %cmp3 = icmp sgt i32 %b, 0 | 192 %cmp3 = icmp sgt i32 %b, 0 |
188 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9 | 193 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9 |
189 | 194 |
282 !13 = !{!13, !14} | 287 !13 = !{!13, !14} |
283 !14 = !{!"llvm.loop.unroll.enable"} | 288 !14 = !{!"llvm.loop.unroll.enable"} |
284 | 289 |
285 ; #pragma clang loop unroll(enable) | 290 ; #pragma clang loop unroll(enable) |
286 ; Loop has a runtime trip count and should be runtime unrolled and duplicated | 291 ; Loop has a runtime trip count and should be runtime unrolled and duplicated |
287 ; (original and 8x). | 292 ; (original and 8x) if remainder is allowed, otherwise it should not be |
293 ; unrolled. | |
288 ; | 294 ; |
289 ; CHECK-LABEL: @runtime_loop_with_enable( | 295 ; CHECK-LABEL: @runtime_loop_with_enable( |
290 ; CHECK: for.body: | 296 ; CHECK: for.body: |
291 ; CHECK: store i32 | 297 ; CHECK: store i32 |
292 ; CHECK: store i32 | 298 ; REM: store i32 |
293 ; CHECK: store i32 | 299 ; REM: store i32 |
294 ; CHECK: store i32 | 300 ; REM: store i32 |
295 ; CHECK: store i32 | 301 ; REM: store i32 |
296 ; CHECK: store i32 | 302 ; REM: store i32 |
297 ; CHECK: store i32 | 303 ; REM: store i32 |
298 ; CHECK: store i32 | 304 ; REM: store i32 |
299 ; CHECK-NOT: store i32 | 305 ; CHECK-NOT: store i32 |
300 ; CHECK: br i1 | 306 ; CHECK: br i1 |
301 ; CHECK: for.body.epil: | 307 ; REM: for.body.epil: |
302 ; CHECK: store | 308 ; NOREM-NOT: for.body.epil: |
303 ; CHECK-NOT: store | 309 ; REM: store |
304 ; CHECK: br i1 | 310 ; CHECK-NOT: store |
311 ; REM: br i1 | |
312 ; NOREM-NOT: br i1 | |
305 define void @runtime_loop_with_enable(i32* nocapture %a, i32 %b) { | 313 define void @runtime_loop_with_enable(i32* nocapture %a, i32 %b) { |
306 entry: | 314 entry: |
307 %cmp3 = icmp sgt i32 %b, 0 | 315 %cmp3 = icmp sgt i32 %b, 0 |
308 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !8 | 316 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !8 |
309 | 317 |
323 } | 331 } |
324 !15 = !{!15, !14} | 332 !15 = !{!15, !14} |
325 | 333 |
326 ; #pragma clang loop unroll_count(3) | 334 ; #pragma clang loop unroll_count(3) |
327 ; Loop has a runtime trip count. Runtime unrolling should occur and loop | 335 ; Loop has a runtime trip count. Runtime unrolling should occur and loop |
328 ; should be duplicated (original and 3x unrolled). | 336 ; should be duplicated (original and 3x unrolled) if remainder is allowed, |
337 ; otherwise it should not be unrolled. | |
329 ; | 338 ; |
330 ; CHECK-LABEL: @runtime_loop_with_count3( | 339 ; CHECK-LABEL: @runtime_loop_with_count3( |
331 ; CHECK: for.body | 340 ; CHECK: for.body |
332 ; CHECK: store | 341 ; CHECK: store |
333 ; CHECK: store | 342 ; REM: store |
334 ; CHECK: store | 343 ; REM: store |
335 ; CHECK-NOT: store | 344 ; CHECK-NOT: store |
336 ; CHECK: br i1 | 345 ; CHECK: br i1 |
337 ; CHECK: for.body.epil: | 346 ; REM: for.body.epil: |
338 ; CHECK: store | 347 ; REM: store |
339 ; CHECK-NOT: store | 348 ; NOREM-NOT: for.body.epil: |
340 ; CHECK: br i1 | 349 ; NOREM-NOT: store |
350 ; CHECK-NOT: store | |
351 ; REM: br i1 | |
341 define void @runtime_loop_with_count3(i32* nocapture %a, i32 %b) { | 352 define void @runtime_loop_with_count3(i32* nocapture %a, i32 %b) { |
342 entry: | 353 entry: |
343 %cmp3 = icmp sgt i32 %b, 0 | 354 %cmp3 = icmp sgt i32 %b, 0 |
344 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !16 | 355 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !16 |
345 | 356 |