1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2;RUN: opt -newgvn -S < %s | FileCheck %s
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.12.0"
5
6; Function Attrs: nounwind ssp uwtable
7define void @reorder_ref_pic_list() local_unnamed_addr {
8; CHECK-LABEL: @reorder_ref_pic_list(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    br i1 undef, label [[FOR_END:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
11; CHECK:       for.body.preheader:
12; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
13; CHECK:       for.body:
14; CHECK-NEXT:    [[REFIDXLX_0:%.*]] = phi i32 [ [[INC_I51:%.*]], [[IF_ELSE58:%.*]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
15; CHECK-NEXT:    br i1 undef, label [[IF_THEN13:%.*]], label [[IF_ELSE58]]
16; CHECK:       if.then13:
17; CHECK-NEXT:    [[INC_I:%.*]] = add nsw i32 [[REFIDXLX_0]], 1
18; CHECK-NEXT:    br label [[FOR_BODY8_I:%.*]]
19; CHECK:       for.body8.i:
20; CHECK-NEXT:    br i1 undef, label [[FOR_INC24_I:%.*]], label [[IF_THEN17_I:%.*]]
21; CHECK:       if.then17.i:
22; CHECK-NEXT:    br label [[FOR_INC24_I]]
23; CHECK:       for.inc24.i:
24; CHECK-NEXT:    br label [[FOR_BODY8_I]]
25; CHECK:       if.else58:
26; CHECK-NEXT:    [[INC_I51]] = add nsw i32 [[REFIDXLX_0]], 1
27; CHECK-NEXT:    br label [[FOR_BODY]]
28; CHECK:       for.end:
29; CHECK-NEXT:    ret void
30;
31entry:
32  br i1 undef, label %for.end, label %for.body.preheader
33
34for.body.preheader:                               ; preds = %entry
35  br label %for.body
36
37for.body:                                         ; preds = %if.else58, %for.body.preheader
38  %refIdxLX.0 = phi i32 [ %inc.i51, %if.else58 ], [ 0, %for.body.preheader ]
39  br i1 undef, label %if.then13, label %if.else58
40
41if.then13:                                        ; preds = %for.body
42  %inc.i = add nsw i32 %refIdxLX.0, 1
43  br label %for.body8.i
44
45for.body8.i:                                      ; preds = %for.inc24.i, %if.then13
46  %nIdx.052.i = phi i32 [ %inc.i, %if.then13 ], [ %nIdx.1.i, %for.inc24.i ]
47  br i1 undef, label %for.inc24.i, label %if.then17.i
48
49if.then17.i:                                      ; preds = %for.body8.i
50  br label %for.inc24.i
51
52for.inc24.i:                                      ; preds = %if.then17.i, %for.body8.i
53  %nIdx.1.i = phi i32 [ undef, %if.then17.i ], [ %nIdx.052.i, %for.body8.i ]
54  br label %for.body8.i
55
56if.else58:                                        ; preds = %for.body
57  %inc.i51 = add nsw i32 %refIdxLX.0, 1
58  br label %for.body
59
60for.end:                                          ; preds = %entry
61  ret void
62}
63
64
65
66