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