1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes='loop(indvars,loop-deletion,loop-unroll-full),verify<scalar-evolution>' -S %s | FileCheck %s
4 define void @test(i1 %c.0, ptr %A) {
7 ; CHECK-NEXT: br i1 [[C_0:%.*]], label [[LOOP_1_HEADER_PREHEADER:%.*]], label [[OUTER_HEADER_PREHEADER:%.*]]
8 ; CHECK: outer.header.preheader:
9 ; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
10 ; CHECK: loop.1.header.preheader:
11 ; CHECK-NEXT: br label [[LOOP_1_HEADER:%.*]]
12 ; CHECK: loop.1.header:
13 ; CHECK-NEXT: store i32 0, ptr [[A:%.*]], align 4
14 ; CHECK-NEXT: br label [[LOOP_1_LATCH:%.*]]
15 ; CHECK: loop.1.latch:
16 ; CHECK-NEXT: store i32 0, ptr [[A]], align 4
17 ; CHECK-NEXT: br label [[LOOP_1_LATCH_1:%.*]]
18 ; CHECK: loop.1.latch.1:
19 ; CHECK-NEXT: ret void
20 ; CHECK: outer.header.loopexit:
21 ; CHECK-NEXT: br label [[OUTER_HEADER]]
22 ; CHECK: outer.header:
23 ; CHECK-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 4
24 ; CHECK-NEXT: br label [[OUTER_HEADER_LOOPEXIT:%.*]]
27 br i1 %c.0, label %loop.1.header, label %outer.header
30 %iv.1 = phi i32 [ 0, %entry ], [ 1, %loop.1.latch ]
31 store i32 0, ptr %A, align 4
32 br label %loop.1.latch
35 %cmp.1 = icmp eq i32 %iv.1, 0
36 br i1 %cmp.1, label %loop.1.header, label %exit
39 %l = load i32, ptr %A, align 4
40 br label %inner.header
43 %iv.2 = phi i32 [ 0, %outer.header ], [ %iv.2.next, %inner.outer.latch ]
44 %cmp.2 = icmp eq i32 %iv.2, %l
45 br i1 %cmp.2, label %inner.outer.latch, label %inner.outer.latch
48 %iv.2.next = add nuw nsw i32 %iv.2, 1
49 br i1 false, label %inner.header, label %outer.header