summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/JumpThreading/ddt-crash.ll
blob: a5cf24d354c43b33034fa358dc146a0eb55fedf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
; RUN: opt < %s -jump-threading -disable-output

%struct.ham = type { i8, i8, i16, i32 }
%struct.zot = type { i32 (...)** }
%struct.quux.0 = type { %struct.wombat }
%struct.wombat = type { %struct.zot }

@global = external global %struct.ham*, align 8
@global.1 = external constant i8*

declare i32 @wombat.2()

define void @blam() {
bb:
  %tmp = load i32, i32* undef
  %tmp1 = icmp eq i32 %tmp, 0
  br i1 %tmp1, label %bb11, label %bb2

bb2:
  %tmp3 = tail call i32 @wombat.2()
  switch i32 %tmp3, label %bb4 [
    i32 0, label %bb5
    i32 1, label %bb7
    i32 2, label %bb7
    i32 3, label %bb11
  ]

bb4:
  br label %bb7

bb5:
  %tmp6 = tail call i32 @wombat.2()
  br label %bb7

bb7:
  %tmp8 = phi i32 [ 0, %bb5 ], [ 1, %bb4 ], [ 2, %bb2 ], [ 2, %bb2 ]
  %tmp9 = icmp eq i32 %tmp8, 0
  br i1 %tmp9, label %bb11, label %bb10

bb10:
  ret void

bb11:
  ret void
}

define void @spam(%struct.ham* %arg) {
bb:
  %tmp = load i8, i8* undef, align 8
  switch i8 %tmp, label %bb11 [
    i8 1, label %bb11
    i8 2, label %bb11
    i8 3, label %bb1
    i8 4, label %bb1
  ]

bb1:
  br label %bb2

bb2:
  %tmp3 = phi i32 [ 0, %bb1 ], [ %tmp3, %bb8 ]
  br label %bb4

bb4:
  %tmp5 = load i8, i8* undef, align 8
  switch i8 %tmp5, label %bb11 [
    i8 0, label %bb11
    i8 1, label %bb10
    i8 2, label %bb10
    i8 3, label %bb6
    i8 4, label %bb6
  ]

bb6:
  br label %bb7

bb7:
  br i1 undef, label %bb8, label %bb10

bb8:
  %tmp9 = icmp eq %struct.ham* undef, %arg
  br i1 %tmp9, label %bb10, label %bb2

bb10:
  switch i32 %tmp3, label %bb4 [
    i32 0, label %bb14
    i32 1, label %bb11
    i32 2, label %bb12
  ]

bb11:
  unreachable

bb12:
  %tmp13 = load %struct.ham*, %struct.ham** undef
  br label %bb14

bb14:
  %tmp15 = phi %struct.ham* [ %tmp13, %bb12 ], [ null, %bb10 ]
  br label %bb16

bb16:
  %tmp17 = load i8, i8* undef, align 8
  switch i8 %tmp17, label %bb11 [
    i8 0, label %bb11
    i8 11, label %bb18
    i8 12, label %bb18
  ]

bb18:
  br label %bb19

bb19:
  br label %bb20

bb20:
  %tmp21 = load %struct.ham*, %struct.ham** undef
  switch i8 undef, label %bb22 [
    i8 0, label %bb4
    i8 11, label %bb10
    i8 12, label %bb10
  ]

bb22:
  br label %bb23

bb23:
  %tmp24 = icmp eq %struct.ham* %tmp21, null
  br i1 %tmp24, label %bb35, label %bb25

bb25:
  %tmp26 = icmp eq %struct.ham* %tmp15, null
  br i1 %tmp26, label %bb34, label %bb27

bb27:
  %tmp28 = load %struct.ham*, %struct.ham** undef
  %tmp29 = icmp eq %struct.ham* %tmp28, %tmp21
  br i1 %tmp29, label %bb35, label %bb30

bb30:
  br label %bb31

bb31:
  %tmp32 = load i8, i8* undef, align 8
  %tmp33 = icmp eq i8 %tmp32, 0
  br i1 %tmp33, label %bb31, label %bb34

bb34:
  br label %bb35

bb35:
  %tmp36 = phi i1 [ true, %bb34 ], [ false, %bb23 ], [ true, %bb27 ]
  br label %bb37

bb37:
  %tmp38 = icmp eq %struct.ham* %tmp15, null
  br i1 %tmp38, label %bb39, label %bb41

bb39:
  %tmp40 = load %struct.ham*, %struct.ham** @global
  br label %bb41

bb41:
  %tmp42 = select i1 %tmp36, %struct.ham* undef, %struct.ham* undef
  ret void
}

declare i32 @foo(...)

define void @zot() align 2 personality i8* bitcast (i32 (...)* @foo to i8*) {
bb:
  invoke void @bar()
          to label %bb1 unwind label %bb3

bb1:
  invoke void @bar()
          to label %bb2 unwind label %bb4

bb2:
  invoke void @bar()
          to label %bb6 unwind label %bb17

bb3:
  %tmp = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb4:
  %tmp5 = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb6:
  invoke void @bar()
          to label %bb7 unwind label %bb19

bb7:
  invoke void @bar()
          to label %bb10 unwind label %bb8

bb8:
  %tmp9 = landingpad { i8*, i32 }
          cleanup
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb10:
  %tmp11 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
  %tmp12 = invoke i32 %tmp11(%struct.zot* nonnull undef)
          to label %bb13 unwind label %bb21

bb13:
  invoke void @bar()
          to label %bb14 unwind label %bb23

bb14:
  %tmp15 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
  %tmp16 = invoke i32 %tmp15(%struct.zot* nonnull undef)
          to label %bb26 unwind label %bb23

bb17:
  %tmp18 = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb19:
  %tmp20 = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb21:
  %tmp22 = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  unreachable

bb23:
  %tmp24 = phi %struct.quux.0* [ null, %bb26 ], [ null, %bb14 ], [ undef, %bb13 ]
  %tmp25 = landingpad { i8*, i32 }
          catch i8* bitcast (i8** @global.1 to i8*)
          catch i8* null
  br label %bb30

bb26:
  %tmp27 = load i32 (%struct.zot*)*, i32 (%struct.zot*)** undef, align 8
  %tmp28 = invoke i32 %tmp27(%struct.zot* nonnull undef)
          to label %bb29 unwind label %bb23

bb29:
  unreachable

bb30:
  %tmp31 = icmp eq %struct.quux.0* %tmp24, null
  br i1 %tmp31, label %bb32, label %bb29

bb32:
  unreachable
}

declare void @bar()
OpenPOWER on IntegriCloud