1; RUN: opt -mergefunc %s -disable-output 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 = call i8* @llvm.eh.exception() 79 store i8* %eh_ptr, i8** %eh_exception 80 %eh_ptr4 = load i8** %eh_exception 81 %eh_select5 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr4, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) 82 store i32 %eh_select5, i32* %eh_selector 83 %eh_select = load i32* %eh_selector 84 store i32 %eh_select, i32* %save_filt.150, align 4 85 %eh_value = load i8** %eh_exception 86 store i8* %eh_value, i8** %save_eptr.149, align 4 87 %18 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 88 %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"* 89 call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind 90 %20 = load i8** %save_eptr.149, align 4 91 store i8* %20, i8** %eh_exception, align 4 92 %21 = load i32* %save_filt.150, align 4 93 store i32 %21, i32* %eh_selector, align 4 94 %eh_ptr6 = load i8** %eh_exception 95 call void @_Unwind_Resume_or_Rethrow() 96 unreachable 97} 98 99declare void @_ZN2kc13impl_filelineC2Ev() nounwind align 2 100 101define void @_ZN2kc13impl_filelineD1Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 { 102entry: 103 %this_addr = alloca %"struct.kc::impl_fileline"*, align 4 104 %"alloca point" = bitcast i32 0 to i32 105 store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr 106 %0 = load %"struct.kc::impl_fileline"** %this_addr, align 4 107 %1 = getelementptr inbounds %"struct.kc::impl_fileline"* %0, i32 0, i32 0 108 %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0 109 store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4 110 %3 = trunc i32 0 to i8 111 %toBool = icmp ne i8 %3, 0 112 br i1 %toBool, label %bb1, label %return 113 114bb1: ; preds = %entry 115 %4 = load %"struct.kc::impl_fileline"** %this_addr, align 4 116 %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8* 117 call void @_ZdlPv() nounwind 118 br label %return 119 120return: ; preds = %bb1, %entry 121 ret void 122} 123 124declare void @_ZdlPv() nounwind 125 126define void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 { 127entry: 128 %this_addr = alloca %"struct.kc::impl_fileline"*, align 4 129 %"alloca point" = bitcast i32 0 to i32 130 store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr 131 %0 = load %"struct.kc::impl_fileline"** %this_addr, align 4 132 %1 = getelementptr inbounds %"struct.kc::impl_fileline"* %0, i32 0, i32 0 133 %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0 134 store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4 135 %3 = trunc i32 0 to i8 136 %toBool = icmp ne i8 %3, 0 137 br i1 %toBool, label %bb1, label %return 138 139bb1: ; preds = %entry 140 %4 = load %"struct.kc::impl_fileline"** %this_addr, align 4 141 %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8* 142 call void @_ZdlPv() nounwind 143 br label %return 144 145return: ; preds = %bb1, %entry 146 ret void 147} 148 149define void @_ZN2kc22impl_fileline_FileLineC1EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 { 150entry: 151 %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4 152 %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4 153 %_line_addr = alloca i32, align 4 154 %save_filt.148 = alloca i32 155 %save_eptr.147 = alloca i8* 156 %iftmp.99 = alloca %"struct.kc::impl_casestring__Str"* 157 %eh_exception = alloca i8* 158 %eh_selector = alloca i32 159 %"alloca point" = bitcast i32 0 to i32 160 store %"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_fileline_FileLine"** %this_addr 161 store %"struct.kc::impl_casestring__Str"* %_file, %"struct.kc::impl_casestring__Str"** %_file_addr 162 store i32 %_line, i32* %_line_addr 163 %0 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 164 %1 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %0, i32 0, i32 0 165 call void @_ZN2kc13impl_filelineC2Ev() nounwind 166 %2 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 167 %3 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %2, i32 0, i32 0 168 %4 = getelementptr inbounds %"struct.kc::impl_fileline"* %3, i32 0, i32 0 169 %5 = getelementptr inbounds %"struct.kc::impl_abstract_phylum"* %4, i32 0, i32 0 170 store i32 (...)** getelementptr inbounds ([13 x i32 (...)*]* @_ZTVN2kc22impl_fileline_FileLineE, i32 0, i32 2), i32 (...)*** %5, align 4 171 %6 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 172 %7 = icmp eq %"struct.kc::impl_casestring__Str"* %6, null 173 br i1 %7, label %bb, label %bb1 174 175bb: ; preds = %entry 176 %8 = invoke %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci() 177 to label %invcont unwind label %lpad 178 179invcont: ; preds = %bb 180 store %"struct.kc::impl_casestring__Str"* %8, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 181 br label %bb2 182 183bb1: ; preds = %entry 184 %9 = load %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 185 store %"struct.kc::impl_casestring__Str"* %9, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 186 br label %bb2 187 188bb2: ; preds = %bb1, %invcont 189 %10 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 190 %11 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %10, i32 0, i32 0 191 %12 = getelementptr inbounds %"struct.kc::impl_fileline"* %11, i32 0, i32 1 192 %13 = load %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 193 store %"struct.kc::impl_casestring__Str"* %13, %"struct.kc::impl_casestring__Str"** %12, align 4 194 %14 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 195 %15 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine"* %14, i32 0, i32 0 196 %16 = getelementptr inbounds %"struct.kc::impl_fileline"* %15, i32 0, i32 2 197 %17 = load i32* %_line_addr, align 4 198 store i32 %17, i32* %16, align 4 199 ret void 200 201lpad: ; preds = %bb 202 %eh_ptr = call i8* @llvm.eh.exception() 203 store i8* %eh_ptr, i8** %eh_exception 204 %eh_ptr4 = load i8** %eh_exception 205 %eh_select5 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr4, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) 206 store i32 %eh_select5, i32* %eh_selector 207 %eh_select = load i32* %eh_selector 208 store i32 %eh_select, i32* %save_filt.148, align 4 209 %eh_value = load i8** %eh_exception 210 store i8* %eh_value, i8** %save_eptr.147, align 4 211 %18 = load %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 212 %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"* 213 call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind 214 %20 = load i8** %save_eptr.147, align 4 215 store i8* %20, i8** %eh_exception, align 4 216 %21 = load i32* %save_filt.148, align 4 217 store i32 %21, i32* %eh_selector, align 4 218 %eh_ptr6 = load i8** %eh_exception 219 call void @_Unwind_Resume_or_Rethrow() 220 unreachable 221} 222 223declare i8* @llvm.eh.exception() nounwind readonly 224 225declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind 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