1 ; RUN: opt < %s -jump-threading -disable-output
3 %struct.ham = type { i8, i8, i16, i32 }
4 %struct.zot = type { i32 (...)** }
5 %struct.quux.0 = type { %struct.wombat }
6 %struct.wombat = type { %struct.zot }
8 @global = external global %struct.ham*, align 8
9 @global.1 = external constant i8*
11 declare i32 @wombat.2()
15 %tmp = load i32, i32* undef
16 %tmp1 = icmp eq i32 %tmp, 0
17 br i1 %tmp1, label %bb11, label %bb2
20 %tmp3 = tail call i32 @wombat.2()
21 switch i32 %tmp3, label %bb4 [
32 %tmp6 = tail call i32 @wombat.2()
36 %tmp8 = phi i32 [ 0, %bb5 ], [ 1, %bb4 ], [ 2, %bb2 ], [ 2, %bb2 ]
37 %tmp9 = icmp eq i32 %tmp8, 0
38 br i1 %tmp9, label %bb11, label %bb10
47 define void @spam(%struct.ham* %arg) {
49 %tmp = load i8, i8* undef, align 8
50 switch i8 %tmp, label %bb11 [
61 %tmp3 = phi i32 [ 0, %bb1 ], [ %tmp3, %bb8 ]
65 %tmp5 = load i8, i8* undef, align 8
66 switch i8 %tmp5, label %bb11 [
78 br i1 undef, label %bb8, label %bb10
81 %tmp9 = icmp eq %struct.ham* undef, %arg
82 br i1 %tmp9, label %bb10, label %bb2
85 switch i32 %tmp3, label %bb4 [
95 %tmp13 = load %struct.ham*, %struct.ham** undef
99 %tmp15 = phi %struct.ham* [ %tmp13, %bb12 ], [ null, %bb10 ]
103 %tmp17 = load i8, i8* undef, align 8
104 switch i8 %tmp17, label %bb11 [
117 %tmp21 = load %struct.ham*, %struct.ham** undef
118 switch i8 undef, label %bb22 [
128 %tmp24 = icmp eq %struct.ham* %tmp21, null
129 br i1 %tmp24, label %bb35, label %bb25
132 %tmp26 = icmp eq %struct.ham* %tmp15, null
133 br i1 %tmp26, label %bb34, label %bb27
136 %tmp28 = load %struct.ham*, %struct.ham** undef
137 %tmp29 = icmp eq %struct.ham* %tmp28, %tmp21
138 br i1 %tmp29, label %bb35, label %bb30
144 %tmp32 = load i8, i8* undef, align 8
145 %tmp33 = icmp eq i8 %tmp32, 0
146 br i1 %tmp33, label %bb31, label %bb34
152 %tmp36 = phi i1 [ true, %bb34 ], [ false, %bb23 ], [ true, %bb27 ]
156 %tmp38 = icmp eq %struct.ham* %tmp15, null
157 br i1 %tmp38, label %bb39, label %bb41
160 %tmp40 = load %struct.ham*, %struct.ham** @global
164 %tmp42 = select i1 %tmp36, %struct.ham* undef, %struct.ham* undef
168 declare i32 @foo(...)
170 define void @zot() align 2 personality i8* bitcast (i32 (...)* @foo to i8*) {
173 to label %bb1 unwind label %bb3
177 to label %bb2 unwind label %bb4
181 to label %bb6 unwind label %bb17
184 %tmp = landingpad { i8*, i32 }
185 catch i8* bitcast (i8** @global.1 to i8*)
190 %tmp5 = landingpad { i8*, i32 }
191 catch i8* bitcast (i8** @global.1 to i8*)
197 to label %bb7 unwind label %bb19
201 to label %bb10 unwind label %bb8
204 %tmp9 = landingpad { i8*, i32 }
206 catch i8* bitcast (i8** @global.1 to i8*)
211 %tmp11 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
212 %tmp12 = invoke i32 %tmp11(%struct.zot* nonnull undef)
213 to label %bb13 unwind label %bb21
217 to label %bb14 unwind label %bb23
220 %tmp15 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
221 %tmp16 = invoke i32 %tmp15(%struct.zot* nonnull undef)
222 to label %bb26 unwind label %bb23
225 %tmp18 = landingpad { i8*, i32 }
226 catch i8* bitcast (i8** @global.1 to i8*)
231 %tmp20 = landingpad { i8*, i32 }
232 catch i8* bitcast (i8** @global.1 to i8*)
237 %tmp22 = landingpad { i8*, i32 }
238 catch i8* bitcast (i8** @global.1 to i8*)
243 %tmp24 = phi %struct.quux.0* [ null, %bb26 ], [ null, %bb14 ], [ undef, %bb13 ]
244 %tmp25 = landingpad { i8*, i32 }
245 catch i8* bitcast (i8** @global.1 to i8*)
250 %tmp27 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
251 %tmp28 = invoke i32 %tmp27(%struct.zot* nonnull undef)
252 to label %bb29 unwind label %bb23
258 %tmp31 = icmp eq %struct.quux.0* %tmp24, null
259 br i1 %tmp31, label %bb32, label %bb29