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