1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes='print<scalar-evolution>,loop(loop-unroll-full,indvars)' < %s 2>/dev/null | FileCheck %s
3 @g = constant [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
8 ; CHECK-LABEL: define void @test() {
10 ; CHECK-NEXT: br label [[LOOP:%.*]]
12 ; CHECK-NEXT: br label [[LOOP2:%.*]]
14 ; CHECK-NEXT: br i1 false, label [[LOOP2]], label [[LOOP_LATCH:%.*]], !llvm.loop [[LOOP0:![0-9]+]]
16 ; CHECK-NEXT: call void @use(i32 3)
17 ; CHECK-NEXT: br label [[LOOP2_1:%.*]]
19 ; CHECK-NEXT: br i1 false, label [[LOOP2_1]], label [[LOOP_LATCH_1:%.*]], !llvm.loop [[LOOP0]]
20 ; CHECK: loop.latch.1:
21 ; CHECK-NEXT: call void @use(i32 4)
22 ; CHECK-NEXT: ret void
28 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ]
29 %iv.next = add i64 %iv, 1
33 %iv2 = phi i64 [ 0, %loop ], [ %iv2.next, %loop2 ]
34 %iv2.next = add i64 %iv2, 1
35 %idx = add i64 %iv, %iv2
36 %gep = getelementptr i32, ptr @g, i64 %idx
37 %load = load i32, ptr %gep
38 %cmp2 = icmp ne i64 %iv2, 3
39 br i1 %cmp2, label %loop2, label %loop.latch, !llvm.loop !0
42 %load.lcssa = phi i32 [ %load, %loop2 ]
43 call void @use(i32 %load)
44 %cmp = icmp ne i64 %iv, 1
45 br i1 %cmp, label %loop, label %exit
51 !0 = distinct !{!0, !1}
52 !1 = !{!"llvm.loop.unroll.disable", i1 true}