• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -passes='print<phi-values>' -disable-output 2>&1 | FileCheck %s
2
3; This test uses a long chain of phis that take themselves as an operand, which causes
4; phi values analysis to segfault if it's not careful about that kind of thing.
5
6; CHECK-LABEL: PHI Values for function: fn
7define void @fn(i32* %arg) {
8entry:
9  br label %while1.cond
10
11while1.cond:
12; CHECK: PHI %phi1 has values:
13; CHECK: i32* %arg
14  %phi1 = phi i32* [ %arg, %entry ], [ %phi2, %while1.then ]
15  br i1 undef, label %while1.end, label %while1.body
16
17while1.body:
18  br i1 undef, label %while1.then, label %while1.if
19
20while1.if:
21  br label %while1.then
22
23while1.then:
24; CHECK: PHI %phi2 has values:
25; CHECK: i32* %arg
26  %phi2 = phi i32* [ %arg, %while1.if ], [ %phi1, %while1.body ]
27  br label %while1.cond
28
29while1.end:
30  br label %while2.cond1
31
32while2.cond1:
33; CHECK: PHI %phi3 has values:
34; CHECK: i32* %arg
35  %phi3 = phi i32* [ %phi1, %while1.end ], [ %phi5, %while2.then ]
36  br i1 undef, label %while2.end, label %while2.body1
37
38while2.body1:
39  br i1 undef, label %while2.cond2, label %while2.then
40
41while2.cond2:
42; CHECK: PHI %phi4 has values:
43; CHECK: i32* %arg
44  %phi4 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.if ]
45  br i1 undef, label %while2.then, label %while2.if
46
47while2.if:
48  br label %while2.cond2
49
50while2.then:
51; CHECK: PHI %phi5 has values:
52; CHECK: i32* %arg
53  %phi5 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.cond2 ]
54  br label %while2.cond1
55
56while2.end:
57  br label %while3.cond1
58
59while3.cond1:
60; CHECK: PHI %phi6 has values:
61; CHECK: i32* %arg
62  %phi6 = phi i32* [ %phi3, %while2.end ], [ %phi7, %while3.cond2 ]
63  br i1 undef, label %while3.end, label %while3.cond2
64
65while3.cond2:
66; CHECK: PHI %phi7 has values:
67; CHECK: i32* %arg
68  %phi7 = phi i32* [ %phi6, %while3.cond1 ], [ %phi7, %while3.body ]
69  br i1 undef, label %while3.cond1, label %while3.body
70
71while3.body:
72  br label %while3.cond2
73
74while3.end:
75  br label %while4.cond1
76
77while4.cond1:
78; CHECK: PHI %phi8 has values:
79; CHECK: i32* %arg
80  %phi8 = phi i32* [ %phi6, %while3.end ], [ %phi10, %while4.then ]
81  br i1 undef, label %while4.end, label %while4.if
82
83while4.if:
84  br i1 undef, label %while4.cond2, label %while4.then
85
86while4.cond2:
87; CHECK: PHI %phi9 has values:
88; CHECK: i32* %arg
89  %phi9 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.body ]
90  br i1 undef, label %while4.then, label %while4.body
91
92while4.body:
93  br label %while4.cond2
94
95while4.then:
96; CHECK: PHI %phi10 has values:
97; CHECK: i32* %arg
98  %phi10 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.cond2 ]
99  br label %while4.cond1
100
101while4.end:
102  br label %while5.cond
103
104while5.cond:
105; CHECK: PHI %phi11 has values:
106; CHECK: i32* %arg
107  %phi11 = phi i32* [ %phi8, %while4.end ], [ %phi13, %while5.then ]
108  br i1 undef, label %while5.end, label %while5.body1
109
110while5.body1:
111  br i1 undef, label %while5.if, label %while5.then
112
113while5.if:
114; CHECK: PHI %phi12 has values:
115; CHECK: i32* %arg
116  %phi12 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.body2 ]
117  br i1 undef, label %while5.then, label %while5.body2
118
119while5.body2:
120  br label %while5.if
121
122while5.then:
123; CHECK: PHI %phi13 has values:
124; CHECK: i32* %arg
125  %phi13 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.if ]
126  br label %while5.cond
127
128while5.end:
129  br label %while6.cond1
130
131while6.cond1:
132; CHECK: PHI %phi14 has values:
133; CHECK: i32* %arg
134  %phi14 = phi i32* [ %phi11, %while5.end ], [ %phi14, %while6.cond1 ]
135  br i1 undef, label %while6.cond2, label %while6.cond1
136
137while6.cond2:
138; CHECK: PHI %phi15 has values:
139; CHECK: i32* %arg
140  %phi15 = phi i32* [ %phi14, %while6.cond1 ], [ %phi15, %while6.cond2 ]
141  br label %while6.cond2
142}
143