1; RUN: opt < %s -passes='print<phi-values>' -disable-output 2>&1 | FileCheck %s
2
3; This test has a phi with a large number of incoming values that are all the
4; same phi, and that phi depends on this phi. This is to check that phi values
5; analysis doesn't repeatedly add a phis values to itself until it segfaults.
6
7; CHECK-LABEL: PHI Values for function: fn
8define void @fn(i8* %arg) {
9entry:
10  br label %for.body
11
12for.body:
13; CHECK: PHI %phi1 has values:
14; CHECK-DAG: i8* %arg
15; CHECK-DAG: i8* undef
16  %phi1 = phi i8* [ %arg, %entry ], [ %phi2, %end ]
17  switch i32 undef, label %end [
18    i32 1, label %bb1
19    i32 2, label %bb2
20    i32 3, label %bb3
21    i32 4, label %bb4
22    i32 5, label %bb5
23    i32 6, label %bb6
24    i32 7, label %bb7
25    i32 8, label %bb8
26    i32 9, label %bb9
27    i32 10, label %bb10
28    i32 11, label %bb11
29    i32 12, label %bb12
30    i32 13, label %bb13
31  ]
32
33bb1:
34  br label %end
35
36bb2:
37  br label %end
38
39bb3:
40  br label %end
41
42bb4:
43  br label %end
44
45bb5:
46  br label %end
47
48bb6:
49  br label %end
50
51bb7:
52  br label %end
53
54bb8:
55  br label %end
56
57bb9:
58  br label %end
59
60bb10:
61  br label %end
62
63bb11:
64  br label %end
65
66bb12:
67  br label %end
68
69bb13:
70  br label %end
71
72end:
73; CHECK: PHI %phi2 has values:
74; CHECK-DAG: i8* %arg
75; CHECK-DAG: i8* undef
76  %phi2 = phi i8* [ %phi1, %for.body ], [ %phi1, %bb1 ], [ %phi1, %bb2 ], [ %phi1, %bb3 ], [ %phi1, %bb4 ], [ %phi1, %bb5 ], [ %phi1, %bb6 ], [ %phi1, %bb7 ], [ undef, %bb8 ], [ %phi1, %bb9 ], [ %phi1, %bb10 ], [ %phi1, %bb11 ], [ %phi1, %bb12 ], [ %phi1, %bb13 ]
77  br label %for.body
78}
79