1; RUN: opt < %s -loop-deletion -S
2; RUN: opt < %s -loop-deletion -analyze -domtree 2>&1 | FileCheck -check-prefix=DT %s
3; RUN: opt < %s -loop-deletion -analyze -verify-dom-info
4
5; CHECK: for.body
6; CHECK-NOT: for.cond1
7
8; Verify only the important parts of the DomTree.
9; DT: [1] %entry
10; DT:   [2] %for.cond
11; DT:     [3] %lbl63A679E5
12; DT:     [3] %for.cond9
13; DT:     [3] %lbl64774A9B
14; DT:     [3] %for.body
15; DT:       [4] %for.cond3.loopexit
16
17define i32 @fn1() {
18entry:
19  br label %for.cond
20
21for.cond:                                         ; preds = %entry
22  br i1 undef, label %lbl63A679E5, label %for.body
23
24for.body:                                         ; preds = %for.cond
25  br label %for.cond1
26
27for.cond1:                                        ; preds = %for.cond1, %for.body
28  br i1 undef, label %for.cond1, label %for.cond3.loopexit
29
30for.cond3.loopexit:                               ; preds = %for.cond1
31  br label %for.cond3
32
33for.cond3:                                        ; preds = %for.cond9, %for.cond3.loopexit
34  br i1 undef, label %for.body4, label %for.cond17
35
36for.body4:                                        ; preds = %for.cond3
37  br label %for.cond5
38
39for.cond5:                                        ; preds = %lbl63A679E5, %for.body4
40  br label %for.cond9
41
42lbl63A679E5:                                      ; preds = %for.cond
43  br label %for.cond5
44
45for.cond9:                                        ; preds = %for.end14.split, %for.cond5
46  br i1 undef, label %for.cond3, label %lbl64774A9B
47
48lbl64774A9B:                                      ; preds = %for.cond17, %for.cond9
49  br label %for.end14.split
50
51for.end14.split:                                  ; preds = %lbl64774A9B
52  br label %for.cond9
53
54for.cond17:                                       ; preds = %for.cond3
55  br label %lbl64774A9B
56}
57