1 ; RUN: opt < %s -passes='print<phi-values>' -disable-output 2>&1 | FileCheck %s
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.
6 ; CHECK-LABEL: PHI Values for function: fn
7 define void @fn(i32* %arg) {
12 ; CHECK: PHI %phi1 has values:
14 %phi1 = phi i32* [ %arg, %entry ], [ %phi2, %while1.then ]
15 br i1 undef, label %while1.end, label %while1.body
18 br i1 undef, label %while1.then, label %while1.if
24 ; CHECK: PHI %phi2 has values:
26 %phi2 = phi i32* [ %arg, %while1.if ], [ %phi1, %while1.body ]
30 br label %while2.cond1
33 ; CHECK: PHI %phi3 has values:
35 %phi3 = phi i32* [ %phi1, %while1.end ], [ %phi5, %while2.then ]
36 br i1 undef, label %while2.end, label %while2.body1
39 br i1 undef, label %while2.cond2, label %while2.then
42 ; CHECK: PHI %phi4 has values:
44 %phi4 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.if ]
45 br i1 undef, label %while2.then, label %while2.if
48 br label %while2.cond2
51 ; CHECK: PHI %phi5 has values:
53 %phi5 = phi i32* [ %phi3, %while2.body1 ], [ %phi4, %while2.cond2 ]
54 br label %while2.cond1
57 br label %while3.cond1
60 ; CHECK: PHI %phi6 has values:
62 %phi6 = phi i32* [ %phi3, %while2.end ], [ %phi7, %while3.cond2 ]
63 br i1 undef, label %while3.end, label %while3.cond2
66 ; CHECK: PHI %phi7 has values:
68 %phi7 = phi i32* [ %phi6, %while3.cond1 ], [ %phi7, %while3.body ]
69 br i1 undef, label %while3.cond1, label %while3.body
72 br label %while3.cond2
75 br label %while4.cond1
78 ; CHECK: PHI %phi8 has values:
80 %phi8 = phi i32* [ %phi6, %while3.end ], [ %phi10, %while4.then ]
81 br i1 undef, label %while4.end, label %while4.if
84 br i1 undef, label %while4.cond2, label %while4.then
87 ; CHECK: PHI %phi9 has values:
89 %phi9 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.body ]
90 br i1 undef, label %while4.then, label %while4.body
93 br label %while4.cond2
96 ; CHECK: PHI %phi10 has values:
98 %phi10 = phi i32* [ %phi8, %while4.if ], [ %phi9, %while4.cond2 ]
99 br label %while4.cond1
102 br label %while5.cond
105 ; CHECK: PHI %phi11 has values:
107 %phi11 = phi i32* [ %phi8, %while4.end ], [ %phi13, %while5.then ]
108 br i1 undef, label %while5.end, label %while5.body1
111 br i1 undef, label %while5.if, label %while5.then
114 ; CHECK: PHI %phi12 has values:
116 %phi12 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.body2 ]
117 br i1 undef, label %while5.then, label %while5.body2
123 ; CHECK: PHI %phi13 has values:
125 %phi13 = phi i32* [ %phi11, %while5.body1 ], [ %phi12, %while5.if ]
126 br label %while5.cond
129 br label %while6.cond1
132 ; CHECK: PHI %phi14 has values:
134 %phi14 = phi i32* [ %phi11, %while5.end ], [ %phi14, %while6.cond1 ]
135 br i1 undef, label %while6.cond2, label %while6.cond1
138 ; CHECK: PHI %phi15 has values:
140 %phi15 = phi i32* [ %phi14, %while6.cond1 ], [ %phi15, %while6.cond2 ]
141 br label %while6.cond2