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