1; RUN: opt < %s -debug-pass=Structure -indvars -gvn -indvars -enable-new-pm=0 2>&1 -S | FileCheck --check-prefix=CHECK --check-prefix=IR %s
2; RUN: opt < %s -debug-pass-manager -passes='require<domtree>,loop(loop-simplifycfg),gvn,loop(indvars)' 2>&1 -S | FileCheck --check-prefix=NEW-PM --check-prefix=IR %s
3
4; Check CFG-only analysis are preserved by SCCP by running it between 2
5; loop-vectorize runs.
6
7; CHECK: Dominator Tree Construction
8; CHECK: Natural Loop Information
9; CHECK: Canonicalize natural loops
10; CHECK: LCSSA Verifier
11; CHECK: Loop-Closed SSA Form Pass
12; CHECK: Global Value Numbering
13; CHECK-NOT: Dominator Tree Construction
14; CHECK-NOT: Natural Loop Information
15; CHECK: Canonicalize natural loops
16
17; NEW-PM-DAG: Running analysis: LoopAnalysis on test
18; NEW-PM-DAG: Running analysis: DominatorTreeAnalysis on test
19; NEW-PM: Running pass: GVN on test
20; NEW-PM-NOT: Running analysis: LoopAnalysis on test
21; NEW-PM-NOT: Running analysis: DominatorTreeAnalysis on test
22
23declare i1 @cond()
24declare void @dostuff()
25
26define i32 @test() {
27; IR-LABEL: define i32 @test()
28; IR-LABEL: header:
29; IR:         br i1 false, label %then, label %latch
30; IR-LABEL: then:
31; IR-NEXT:   call void @dostuff()
32; IR-NEXT:   br label %latch
33entry:
34  %res = add i32 1, 10
35  br label %header
36
37header:
38  %iv = phi i32 [ %res, %entry ], [ 0, %latch ]
39  %ic = icmp eq i32 %res, 99
40  br i1 %ic, label %then, label %latch
41
42then:
43  br label %then.2
44
45then.2:
46  call void @dostuff()
47  br label %latch
48
49
50latch:
51  %ec = call i1 @cond()
52  br i1 %ec, label %exit, label %header
53
54exit:
55  ret i32 %iv
56}
57