1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -passes=newgvn -S | FileCheck %s
4 @last = external global [65 x ptr]
6 define i32 @NextRootMove(i32 %wtm, i32 %x, i32 %y, i32 %z) {
7 ; CHECK-LABEL: define i32 @NextRootMove
8 ; CHECK-SAME: (i32 [[WTM:%.*]], i32 [[X:%.*]], i32 [[Y:%.*]], i32 [[Z:%.*]]) {
10 ; CHECK-NEXT: [[A:%.*]] = alloca ptr, align 8
11 ; CHECK-NEXT: [[TMP17618:%.*]] = load ptr, ptr getelementptr ([65 x ptr], ptr @last, i32 0, i32 1), align 4
12 ; CHECK-NEXT: store ptr [[TMP17618]], ptr [[A]], align 8
13 ; CHECK-NEXT: br label [[COND_TRUE116:%.*]]
14 ; CHECK: cond_true116:
15 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X]], [[Y]]
16 ; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE128:%.*]], label [[COND_TRUE145:%.*]]
17 ; CHECK: cond_true128:
18 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[X]], [[Z]]
19 ; CHECK-NEXT: br i1 [[CMP1]], label [[BB98_BACKEDGE:%.*]], label [[RETURN_LOOPEXIT:%.*]]
20 ; CHECK: bb98.backedge:
21 ; CHECK-NEXT: br label [[COND_TRUE116]]
22 ; CHECK: cond_true145:
23 ; CHECK-NEXT: br i1 false, label [[BB98_BACKEDGE]], label [[RETURN_LOOPEXIT]]
24 ; CHECK: return.loopexit:
25 ; CHECK-NEXT: br label [[RETURN:%.*]]
27 ; CHECK-NEXT: ret i32 0
31 %tmp17618 = load ptr, ptr getelementptr ([65 x ptr], ptr @last, i32 0, i32 1), align 4
32 store ptr %tmp17618, ptr %A
33 br label %cond_true116
36 %cmp = icmp eq i32 %x, %y
37 br i1 %cmp, label %cond_true128, label %cond_true145
40 %tmp17625 = load ptr, ptr getelementptr ([65 x ptr], ptr @last, i32 0, i32 1), align 4
41 store ptr %tmp17625, ptr %A
42 %cmp1 = icmp eq i32 %x, %z
43 br i1 %cmp1 , label %bb98.backedge, label %return.loopexit
46 br label %cond_true116
49 %tmp17631 = load ptr, ptr getelementptr ([65 x ptr], ptr @last, i32 0, i32 1), align 4
50 store ptr %tmp17631, ptr %A
51 br i1 false, label %bb98.backedge, label %return.loopexit