• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -disable-output -print-mustexecute %s 2>&1 | FileCheck %s
3; RUN: opt -disable-output -passes=print-mustexecute %s 2>&1 | FileCheck %s
4
5; In general the CFG below is easily simplified but this is useful for
6; pass ordering issue elimination.
7define i1 @const_cond(i32 %high) {
8; CHECK-LABEL: @const_cond(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    br label [[LOOP:%.*]]
11; CHECK:       loop:
12; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] ; (mustexec in: loop)
13; CHECK-NEXT:    br i1 true, label [[NEXT:%.*]], label [[NEVER1:%.*]] ; (mustexec in: loop)
14; CHECK:       next:
15; CHECK-NEXT:    br i1 false, label [[NEVER2:%.*]], label [[BACKEDGE]] ; (mustexec in: loop)
16; CHECK:       backedge:
17; CHECK-NEXT:    [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1 ; (mustexec in: loop)
18; CHECK-NEXT:    [[EXIT_TEST:%.*]] = icmp slt i32 [[IV]], [[HIGH:%.*]] ; (mustexec in: loop)
19; CHECK-NEXT:    br i1 [[EXIT_TEST]], label [[LOOP]], label [[EXIT:%.*]] ; (mustexec in: loop)
20; CHECK:       exit:
21; CHECK-NEXT:    ret i1 false
22; CHECK:       never1:
23; CHECK-NEXT:    unreachable
24; CHECK:       never2:
25; CHECK-NEXT:    unreachable
26;
27entry:
28  br label %loop
29
30loop:
31  %iv = phi i32 [0, %entry], [%iv.next, %backedge]
32  br i1 true, label %next, label %never1
33next:
34  br i1 false, label %never2, label %backedge
35backedge:
36  %iv.next = add nsw nuw i32 %iv, 1
37  %exit.test = icmp slt i32 %iv, %high
38  br i1 %exit.test, label %loop, label %exit
39
40exit:
41  ret i1 false
42never1:
43  unreachable
44never2:
45  unreachable
46}
47
48