1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
\r
2 ; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
\r
3 ; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
\r
5 ; In general the CFG below is easily simplified but this is useful for
\r
6 ; pass ordering issue elimination.
\r
7 define i1 @const_cond(i32 %high) {
\r
8 ; CHECK-LABEL: @const_cond(
\r
10 ; CHECK-NEXT: br label [[LOOP:%.*]]
\r
12 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] ; (mustexec in: loop)
\r
13 ; CHECK-NEXT: br i1 true, label [[NEXT:%.*]], label [[NEVER1:%.*]] ; (mustexec in: loop)
\r
15 ; CHECK-NEXT: br i1 false, label [[NEVER2:%.*]], label [[BACKEDGE]] ; (mustexec in: loop)
\r
17 ; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 ; (mustexec in: loop)
\r
18 ; CHECK-NEXT: [[EXIT_TEST:%.*]] = icmp slt i32 [[IV]], [[HIGH:%.*]] ; (mustexec in: loop)
\r
19 ; CHECK-NEXT: br i1 [[EXIT_TEST]], label [[LOOP]], label [[EXIT:%.*]] ; (mustexec in: loop)
\r
21 ; CHECK-NEXT: ret i1 false
\r
23 ; CHECK-NEXT: unreachable
\r
25 ; CHECK-NEXT: unreachable
\r
31 %iv = phi i32 [0, %entry], [%iv.next, %backedge]
\r
32 br i1 true, label %next, label %never1
\r
34 br i1 false, label %never2, label %backedge
\r
36 %iv.next = add nsw nuw i32 %iv, 1
\r
37 %exit.test = icmp slt i32 %iv, %high
\r
38 br i1 %exit.test, label %loop, label %exit
\r