1; Basic test to check that DominatorTreeAnalysis is preserved by IPSCCP and
2; the following analysis can re-use it. The test contains two trivial functions
3; IPSCCP can simplify, so we can test the case where IPSCCP makes changes.
4
5; RUN: opt -disable-verify -debug-pass-manager \
6; RUN:     -passes='function(require<domtree>,require<postdomtree>),ipsccp,function(require<domtree>,require<postdomtree>)' -S  %s 2>&1 \
7; RUN:     | FileCheck -check-prefixes='IR,NEW-PM' %s
8
9; RUN: opt -passes='function(require<postdomtree>),ipsccp,function(verify<domtree>)' -S  %s | FileCheck -check-prefixes='IR' %s
10
11; NEW-PM: Running analysis: DominatorTreeAnalysis on f1
12; NEW-PM: Running analysis: PostDominatorTreeAnalysis on f1
13; NEW-PM: Running analysis: DominatorTreeAnalysis on f2
14; NEW-PM: Running analysis: PostDominatorTreeAnalysis on f2
15; NEW-PM: Running pass: IPSCCPPass
16; NEW-PM-DAG: Running analysis: AssumptionAnalysis on f1
17; NEW-PM-DAG: Running analysis: AssumptionAnalysis on f2
18; NEW-PM-NOT: Running analysis: AssumptionAnalysis
19
20; IR-LABEL: @f1
21; IR-LABEL: entry:
22; IR-NEXT: br label %bb2
23; IR-LABEL: bb2:
24; IR-NEXT: undef
25
26; IR-LABEL: @f2
27; IR-NOT: icmp
28; IR:    br label %bbtrue
29; IR-LABEL: bbtrue:
30; IR-NEXT:   ret i32 0
31define internal i32 @f1() readnone {
32entry:
33  br i1 false, label %bb1, label %bb2
34bb1:
35  ret i32 10
36bb2:
37  ret i32 10
38}
39
40define i32 @f2(i32 %n) {
41  %i = call i32 @f1()
42  %cmp = icmp eq i32 %i, 10
43  br i1 %cmp, label %bbtrue, label %bbfalse
44
45bbtrue:
46  ret i32 0
47
48bbfalse:
49  %res = add i32 %n, %i
50  ret i32 %res
51}
52