1; RUN: opt -mergefunc -disable-output < %s
2; This used to crash.
3
4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
5target triple = "i386-pc-linux-gnu"
6
7%"struct.kc::impl_Ccode_option" = type { %"struct.kc::impl_abstract_phylum" }
8%"struct.kc::impl_CexpressionDQ" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_CexpressionDQ"* }
9%"struct.kc::impl_Ctext" = type { %"struct.kc::impl_Ccode_option", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_Ctext_elem"*, %"struct.kc::impl_Ctext"* }
10%"struct.kc::impl_Ctext_elem" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"* }
11%"struct.kc::impl_ID" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_casestring__Str"*, i32, %"struct.kc::impl_casestring__Str"* }
12%"struct.kc::impl_abstract_phylum" = type { i32 (...)** }
13%"struct.kc::impl_ac_abstract_declarator_AcAbsdeclDirdecl" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_Ccode_option"* }
14%"struct.kc::impl_casestring__Str" = type { %"struct.kc::impl_abstract_phylum", i8* }
15%"struct.kc::impl_elem_patternrepresentation" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_ID"* }
16%"struct.kc::impl_fileline" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_casestring__Str"*, i32 }
17%"struct.kc::impl_fileline_FileLine" = type { %"struct.kc::impl_fileline" }
18%"struct.kc::impl_outmostpatterns" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_elem_patternrepresentation"*, %"struct.kc::impl_outmostpatterns"* }
19%"struct.kc::impl_withcaseinfo_Withcaseinfo" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_Ctext"* }
20
21@_ZTVN2kc13impl_filelineE = external constant [13 x i32 (...)*], align 32
22@.str = external constant [1 x i8], align 1
23@_ZTVN2kc22impl_fileline_FileLineE = external constant [13 x i32 (...)*], align 32
24
25define void @_ZN2kc22impl_fileline_FileLineC2EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 {
26entry:
27  %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4
28  %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4
29  %_line_addr = alloca i32, align 4
30  %save_filt.150 = alloca i32
31  %save_eptr.149 = alloca i8*
32  %iftmp.99 = alloca %"struct.kc::impl_casestring__Str"*
33  %eh_exception = alloca i8*
34  %eh_selector = alloca i32
35  %"alloca point" = bitcast i32 0 to i32
36  store %"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_fileline_FileLine"** %this_addr
37  store %"struct.kc::impl_casestring__Str"* %_file, %"struct.kc::impl_casestring__Str"** %_file_addr
38  store i32 %_line, i32* %_line_addr
39  %0 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
40  %1 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %0, i32 0, i32 0
41  call void @_ZN2kc13impl_filelineC2Ev() nounwind
42  %2 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
43  %3 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %2, i32 0, i32 0
44  %4 = getelementptr inbounds %"struct.kc::impl_fileline"* %3, i32 0, i32 0
45  %5 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %4, i32 0, i32 0
46  store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc22impl_fileline_FileLineE, i32 0, i32 2), i32 (...)*** %5, align 4
47  %6 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4
48  %7 = icmp eq %"struct.kc::impl_casestring__Str"* %6, null
49  br i1 %7, label %bb, label %bb1
50
51bb:                                               ; preds = %entry
52  %8 = invoke %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci()
53          to label %invcont unwind label %lpad
54
55invcont:                                          ; preds = %bb
56  store %"struct.kc::impl_casestring__Str"* %8, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
57  br label %bb2
58
59bb1:                                              ; preds = %entry
60  %9 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4
61  store %"struct.kc::impl_casestring__Str"* %9, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
62  br label %bb2
63
64bb2:                                              ; preds = %bb1, %invcont
65  %10 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
66  %11 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %10, i32 0, i32 0
67  %12 = getelementptr inbounds %"struct.kc::impl_fileline"* %11, i32 0, i32 1
68  %13 = load %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
69  store %"struct.kc::impl_casestring__Str"* %13, %"struct.kc::impl_casestring__Str"** %12, align 4
70  %14 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
71  %15 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %14, i32 0, i32 0
72  %16 = getelementptr inbounds %"struct.kc::impl_fileline"* %15, i32 0, i32 2
73  %17 = load i32* %_line_addr, align 4
74  store i32 %17, i32* %16, align 4
75  ret void
76
77lpad:                                             ; preds = %bb
78  %eh_ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
79              cleanup
80  %exn = extractvalue { i8*, i32 } %eh_ptr, 0
81  store i8* %exn, i8** %eh_exception
82  %eh_ptr4 = load i8** %eh_exception
83  %eh_select5 = extractvalue { i8*, i32 } %eh_ptr, 1
84  store i32 %eh_select5, i32* %eh_selector
85  %eh_select = load i32* %eh_selector
86  store i32 %eh_select, i32* %save_filt.150, align 4
87  %eh_value = load i8** %eh_exception
88  store i8* %eh_value, i8** %save_eptr.149, align 4
89  %18 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
90  %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"*
91  call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind
92  %20 = load i8** %save_eptr.149, align 4
93  store i8* %20, i8** %eh_exception, align 4
94  %21 = load i32* %save_filt.150, align 4
95  store i32 %21, i32* %eh_selector, align 4
96  %eh_ptr6 = load i8** %eh_exception
97  call void @_Unwind_Resume_or_Rethrow()
98  unreachable
99}
100
101declare void @_ZN2kc13impl_filelineC2Ev() nounwind align 2
102
103define void @_ZN2kc13impl_filelineD1Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 {
104entry:
105  %this_addr = alloca %"struct.kc::impl_fileline"*, align 4
106  %"alloca point" = bitcast i32 0 to i32
107  store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr
108  %0 = load %"struct.kc::impl_fileline"** %this_addr, align 4
109  %1 = getelementptr inbounds %"struct.kc::impl_fileline"* %0, i32 0, i32 0
110  %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0
111  store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4
112  %3 = trunc i32 0 to i8
113  %toBool = icmp ne i8 %3, 0
114  br i1 %toBool, label %bb1, label %return
115
116bb1:                                              ; preds = %entry
117  %4 = load %"struct.kc::impl_fileline"** %this_addr, align 4
118  %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8*
119  call void @_ZdlPv() nounwind
120  br label %return
121
122return:                                           ; preds = %bb1, %entry
123  ret void
124}
125
126declare void @_ZdlPv() nounwind
127
128define void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 {
129entry:
130  %this_addr = alloca %"struct.kc::impl_fileline"*, align 4
131  %"alloca point" = bitcast i32 0 to i32
132  store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr
133  %0 = load %"struct.kc::impl_fileline"** %this_addr, align 4
134  %1 = getelementptr inbounds %"struct.kc::impl_fileline"* %0, i32 0, i32 0
135  %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0
136  store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4
137  %3 = trunc i32 0 to i8
138  %toBool = icmp ne i8 %3, 0
139  br i1 %toBool, label %bb1, label %return
140
141bb1:                                              ; preds = %entry
142  %4 = load %"struct.kc::impl_fileline"** %this_addr, align 4
143  %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8*
144  call void @_ZdlPv() nounwind
145  br label %return
146
147return:                                           ; preds = %bb1, %entry
148  ret void
149}
150
151define void @_ZN2kc22impl_fileline_FileLineC1EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 {
152entry:
153  %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4
154  %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4
155  %_line_addr = alloca i32, align 4
156  %save_filt.148 = alloca i32
157  %save_eptr.147 = alloca i8*
158  %iftmp.99 = alloca %"struct.kc::impl_casestring__Str"*
159  %eh_exception = alloca i8*
160  %eh_selector = alloca i32
161  %"alloca point" = bitcast i32 0 to i32
162  store %"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_fileline_FileLine"** %this_addr
163  store %"struct.kc::impl_casestring__Str"* %_file, %"struct.kc::impl_casestring__Str"** %_file_addr
164  store i32 %_line, i32* %_line_addr
165  %0 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
166  %1 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %0, i32 0, i32 0
167  call void @_ZN2kc13impl_filelineC2Ev() nounwind
168  %2 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
169  %3 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %2, i32 0, i32 0
170  %4 = getelementptr inbounds %"struct.kc::impl_fileline"* %3, i32 0, i32 0
171  %5 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %4, i32 0, i32 0
172  store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc22impl_fileline_FileLineE, i32 0, i32 2), i32 (...)*** %5, align 4
173  %6 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4
174  %7 = icmp eq %"struct.kc::impl_casestring__Str"* %6, null
175  br i1 %7, label %bb, label %bb1
176
177bb:                                               ; preds = %entry
178  %8 = invoke %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci()
179          to label %invcont unwind label %lpad
180
181invcont:                                          ; preds = %bb
182  store %"struct.kc::impl_casestring__Str"* %8, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
183  br label %bb2
184
185bb1:                                              ; preds = %entry
186  %9 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4
187  store %"struct.kc::impl_casestring__Str"* %9, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
188  br label %bb2
189
190bb2:                                              ; preds = %bb1, %invcont
191  %10 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
192  %11 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %10, i32 0, i32 0
193  %12 = getelementptr inbounds %"struct.kc::impl_fileline"* %11, i32 0, i32 1
194  %13 = load %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4
195  store %"struct.kc::impl_casestring__Str"* %13, %"struct.kc::impl_casestring__Str"** %12, align 4
196  %14 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
197  %15 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %14, i32 0, i32 0
198  %16 = getelementptr inbounds %"struct.kc::impl_fileline"* %15, i32 0, i32 2
199  %17 = load i32* %_line_addr, align 4
200  store i32 %17, i32* %16, align 4
201  ret void
202
203lpad:                                             ; preds = %bb
204  %eh_ptr = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
205              cleanup
206  %exn = extractvalue { i8*, i32 } %eh_ptr, 0
207  store i8* %exn, i8** %eh_exception
208  %eh_ptr4 = load i8** %eh_exception
209  %eh_select5 = extractvalue { i8*, i32 } %eh_ptr, 1
210  store i32 %eh_select5, i32* %eh_selector
211  %eh_select = load i32* %eh_selector
212  store i32 %eh_select, i32* %save_filt.148, align 4
213  %eh_value = load i8** %eh_exception
214  store i8* %eh_value, i8** %save_eptr.147, align 4
215  %18 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4
216  %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"*
217  call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind
218  %20 = load i8** %save_eptr.147, align 4
219  store i8* %20, i8** %eh_exception, align 4
220  %21 = load i32* %save_filt.148, align 4
221  store i32 %21, i32* %eh_selector, align 4
222  %eh_ptr6 = load i8** %eh_exception
223  call void @_Unwind_Resume_or_Rethrow()
224  unreachable
225}
226
227declare i32 @__gxx_personality_v0(...)
228
229declare void @_Unwind_Resume_or_Rethrow()
230
231define void @_ZN2kc21printer_functor_classC2Ev(%"struct.kc::impl_abstract_phylum"* %this) nounwind align 2 {
232entry:
233  unreachable
234}
235
236define %"struct.kc::impl_Ccode_option"* @_ZN2kc11phylum_castIPNS_17impl_withcaseinfoES1_EET_PT0_(%"struct.kc::impl_Ccode_option"* %t) nounwind {
237entry:
238  ret %"struct.kc::impl_Ccode_option"* null
239}
240
241define %"struct.kc::impl_abstract_phylum"* @_ZNK2kc43impl_ac_direct_declarator_AcDirectDeclProto9subphylumEi(%"struct.kc::impl_ac_abstract_declarator_AcAbsdeclDirdecl"* %this, i32 %no) nounwind align 2 {
242entry:
243  ret %"struct.kc::impl_abstract_phylum"* undef
244}
245
246define void @_ZN2kc30impl_withcaseinfo_WithcaseinfoD0Ev(%"struct.kc::impl_withcaseinfo_Withcaseinfo"* %this) nounwind align 2 {
247entry:
248  unreachable
249}
250
251define void @_ZN2kc30impl_withcaseinfo_WithcaseinfoC1EPNS_26impl_patternrepresentationES2_PNS_10impl_CtextE(%"struct.kc::impl_withcaseinfo_Withcaseinfo"* %this, %"struct.kc::impl_outmostpatterns"* %_patternrepresentation_1, %"struct.kc::impl_outmostpatterns"* %_patternrepresentation_2, %"struct.kc::impl_Ctext"* %_Ctext_1) nounwind align 2 {
252entry:
253  unreachable
254}
255
256define void @_ZN2kc21impl_rewriteviewsinfoC2EPNS_20impl_rewriteviewinfoEPS0_(%"struct.kc::impl_CexpressionDQ"* %this, %"struct.kc::impl_Ccode_option"* %p1, %"struct.kc::impl_CexpressionDQ"* %p2) nounwind align 2 {
257entry:
258  unreachable
259}
260
261define %"struct.kc::impl_Ctext_elem"* @_ZN2kc11phylum_castIPNS_9impl_termENS_20impl_abstract_phylumEEET_PT0_(%"struct.kc::impl_abstract_phylum"* %t) nounwind {
262entry:
263  unreachable
264}
265
266define void @_ZN2kc27impl_ac_parameter_type_listD2Ev(%"struct.kc::impl_Ccode_option"* %this) nounwind align 2 {
267entry:
268  ret void
269}
270
271define void @_ZN2kc21impl_ac_operator_nameD2Ev(%"struct.kc::impl_Ctext_elem"* %this) nounwind align 2 {
272entry:
273  ret void
274}
275
276declare %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci()
277