1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -dse -S %s | FileCheck %s
4 declare i1 @cond() readnone
9 ; CHECK-NEXT: [[M0:%.*]] = alloca [4 x i32], align 16
10 ; CHECK-NEXT: br label [[LOOP_1:%.*]]
12 ; CHECK-NEXT: br label [[LOOP_2:%.*]]
14 ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[LOOP_1]] ], [ [[IV_NEXT:%.*]], [[LOOP_2]] ]
15 ; CHECK-NEXT: [[PTR_1:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[M0]], i64 3, i64 [[IV]]
16 ; CHECK-NEXT: [[PTR_2:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[M0]], i64 0, i64 [[IV]]
17 ; CHECK-NEXT: store i32 20, i32* [[PTR_2]], align 4
18 ; CHECK-NEXT: store i32 30, i32* [[PTR_1]], align 4
19 ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
20 ; CHECK-NEXT: [[C_3:%.*]] = call i1 @cond()
21 ; CHECK-NEXT: br i1 [[C_3]], label [[LOOP_1_LATCH:%.*]], label [[LOOP_2]]
22 ; CHECK: loop.1.latch:
23 ; CHECK-NEXT: [[C_2:%.*]] = call i1 @cond()
24 ; CHECK-NEXT: br i1 [[C_2]], label [[EXIT:%.*]], label [[LOOP_1]]
26 ; CHECK-NEXT: [[PTR_3:%.*]] = getelementptr inbounds [4 x i32], [4 x i32]* [[M0]], i64 0, i64 1
27 ; CHECK-NEXT: [[LV:%.*]] = load i32, i32* [[PTR_3]], align 16
28 ; CHECK-NEXT: ret i32 [[LV]]
31 %M0 = alloca [4 x i32], align 16
38 %iv = phi i64 [ 0, %loop.1 ], [ %iv.next, %loop.2 ]
39 %ptr.1 = getelementptr inbounds [4 x i32], [4 x i32]* %M0, i64 3, i64 %iv
40 store i32 10, i32* %ptr.1, align 4
41 %ptr.2 = getelementptr inbounds [4 x i32], [4 x i32]* %M0, i64 0, i64 %iv
42 store i32 20, i32* %ptr.2, align 4
43 store i32 30, i32* %ptr.1, align 4
44 %iv.next = add nuw nsw i64 %iv, 1
45 %c.3 = call i1 @cond()
46 br i1 %c.3, label %loop.1.latch, label %loop.2
49 %c.2 = call i1 @cond()
50 br i1 %c.2, label %exit, label %loop.1
53 %ptr.3 = getelementptr inbounds [4 x i32], [4 x i32]* %M0, i64 0, i64 1
54 %lv = load i32, i32* %ptr.3, align 16