1 ; RUN: opt -passes=loop-unroll -debug-only=loop-unroll -S < %s 2>&1 | FileCheck %s
5 ; CHECK: Loop Unroll: F[test]
6 ; CHECK-NEXT: Not unrolling loop since parent loop has llvm.loop.unroll_and_jam
7 ; CHECK: Loop Unroll: F[test]
8 ; CHECK-NEXT: Not unrolling loop since it has llvm.loop.unroll_and_jam
11 for.body4.preheader.preheader:
12 br label %for.body4.preheader4
14 for.body4.preheader4: ; preds = %for.cond.cleanup3, %for.body4.preheader.preheader
15 %indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.cond.cleanup3 ], [ 0, %for.body4.preheader.preheader ]
18 for.body4: ; preds = %for.body4.preheader4, %for.body4
19 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body4.preheader4 ]
20 tail call void @test2(i64 %indvars.iv28, i64 %indvars.iv)
21 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
22 %exitcond.not = icmp eq i64 %indvars.iv.next, 10
23 br i1 %exitcond.not, label %for.cond.cleanup3, label %for.body4
25 for.cond.cleanup3: ; preds = %for.body4
26 %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
27 %exitcond31.not = icmp eq i64 %indvars.iv.next29, 10
28 br i1 %exitcond31.not, label %for.cond.cleanup, label %for.body4.preheader4, !llvm.loop !1
30 for.cond.cleanup: ; preds = %for.cond.cleanup3
36 ; CHECK-NOT: Not unrolling loop since {{.*}} llvm.loop.unroll_and_jam
37 define i32 @test_02() {
38 for.body4.preheader.preheader:
39 br label %for.body4.preheader4
41 for.body4.preheader4: ; preds = %for.cond.cleanup3, %for.body4.preheader.preheader
42 %indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.cond.cleanup3 ], [ 0, %for.body4.preheader.preheader ]
45 for.body4: ; preds = %for.body4.preheader4, %for.body4
46 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body4.preheader4 ]
47 tail call void @test2(i64 %indvars.iv28, i64 %indvars.iv)
48 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
49 %exitcond.not = icmp eq i64 %indvars.iv.next, 10
50 br i1 %exitcond.not, label %for.cond.cleanup3, label %for.body4
52 for.cond.cleanup3: ; preds = %for.body4
53 %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
54 %exitcond31.not = icmp eq i64 %indvars.iv.next29, 10
55 br i1 %exitcond31.not, label %for.cond.cleanup, label %for.body4.preheader4, !llvm.loop !2
57 for.cond.cleanup: ; preds = %for.cond.cleanup3
62 ; CHECK-NOT: Not unrolling loop since {{.*}} llvm.loop.unroll_and_jam
63 define i32 @test_03() {
64 for.body4.preheader.preheader:
65 br label %for.body4.preheader4
67 for.body4.preheader4: ; preds = %for.cond.cleanup3, %for.body4.preheader.preheader
68 %indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.cond.cleanup3 ], [ 0, %for.body4.preheader.preheader ]
71 for.body4: ; preds = %for.body4.preheader4, %for.body4
72 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body4.preheader4 ]
73 tail call void @test2(i64 %indvars.iv28, i64 %indvars.iv)
74 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
75 %exitcond.not = icmp eq i64 %indvars.iv.next, 10
76 br i1 %exitcond.not, label %for.cond.cleanup3, label %for.body4
78 for.cond.cleanup3: ; preds = %for.body4
79 %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
80 %exitcond31.not = icmp eq i64 %indvars.iv.next29, 10
81 br i1 %exitcond31.not, label %for.cond.cleanup, label %for.body4.preheader4, !llvm.loop !3
83 for.cond.cleanup: ; preds = %for.cond.cleanup3
87 declare void @test2(i64 signext, i64 signext)
89 !1 = distinct !{!1, !4}
90 !2 = distinct !{!1, !5}
91 !3 = distinct !{!1, !6}
92 !4 = !{!"llvm.loop.unroll_and_jam.count", i32 4}
93 !5 = !{!"llvm.loop.unroll_and_jam.count", i32 1}
94 !6 = !{!"llvm.loop.unroll_and_jam.disable"}