1; RUN: llc < %s -filetype=obj -debug-entry-values 2 3target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" 4target triple = "thumbv7-unknown-linux-gnueabi" 5 6%class.z = type { i8, i8 } 7%struct.y = type { %class.ac } 8%class.ac = type { %"struct.ac::m" } 9%"struct.ac::m" = type { i8 } 10%class.ae = type { i8 } 11%class.o = type { i8 } 12 13@l = dso_local local_unnamed_addr global i8 0, align 1, !dbg !0 14 15; Function Attrs: nounwind 16define dso_local zeroext i1 @_ZN1z2agEv(%class.z* nocapture readonly %this) local_unnamed_addr align 2 !dbg !17 { 17entry: 18 %a = alloca %struct.y, align 1 19 %b = alloca %struct.y, align 1 20 %c = alloca %class.ae, align 1 21 call void @llvm.dbg.value(metadata %class.z* %this, metadata !28, metadata !DIExpression()), !dbg !75 22 %s = getelementptr inbounds %class.z, %class.z* %this, i32 0, i32 0, !dbg !75 23 %0 = load i8, i8* %s, align 1, !dbg !75 24 %tobool = icmp eq i8 %0, 0, !dbg !75 25 br i1 %tobool, label %if.end, label %if.then, !dbg !75 26 27if.then: ; preds = %entry 28 %1 = getelementptr inbounds %struct.y, %struct.y* %a, i32 0, i32 0, i32 0, i32 0, !dbg !82 29 %u.i = getelementptr inbounds %struct.y, %struct.y* %a, i32 0, i32 0, !dbg !94 30 %n.i.i = getelementptr inbounds %struct.y, %struct.y* %a, i32 0, i32 0, i32 0, !dbg !82 31 %call.i.i = call %"struct.ac::m"* @_ZN2ac1mC1EPc(%"struct.ac::m"* nonnull %n.i.i, i8* null), !dbg !82 32 %call2.i.i = call i8* @_ZN2ac2adEv(%class.ac* nonnull %u.i), !dbg !82 33 %cmp.i.i = icmp eq i8* %call2.i.i, null, !dbg !82 34 %frombool.i.i = zext i1 %cmp.i.i to i8, !dbg !82 35 store i8 %frombool.i.i, i8* @l, align 1, !dbg !82 36 br i1 %cmp.i.i, label %_ZN1yC2Ev.exit, label %if.then.i.i, !dbg !82 37 38if.then.i.i: ; preds = %if.then 39 call void @llvm.dbg.value(metadata i32 1, metadata !144, metadata !DIExpression()), !dbg !145 40 call void @_ZdlPv(i8* null), !dbg !145 41 br label %_ZN1yC2Ev.exit, !dbg !145 42 43_ZN1yC2Ev.exit: ; preds = %if.then, %if.then.i.i 44 call void @llvm.dbg.value(metadata i8 1, metadata !31, metadata !DIExpression()), !dbg !75 45 call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %1), !dbg !75 46 br label %cleanup 47 48if.end: ; preds = %entry 49 %ah = getelementptr inbounds %class.z, %class.z* %this, i32 0, i32 1, !dbg !150 50 %2 = load i8, i8* %ah, align 1, !dbg !150 51 %tobool3 = icmp eq i8 %2, 0, !dbg !150 52 br i1 %tobool3, label %if.end7, label %if.then4, !dbg !150 53 54if.then4: ; preds = %if.end 55 %3 = getelementptr inbounds %struct.y, %struct.y* %b, i32 0, i32 0, i32 0, i32 0, !dbg !153 56 call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %3), !dbg !153 57 %u.i11 = getelementptr inbounds %struct.y, %struct.y* %b, i32 0, i32 0, !dbg !153 58 %n.i.i12 = getelementptr inbounds %struct.y, %struct.y* %b, i32 0, i32 0, i32 0, !dbg !153 59 %call.i.i13 = call %"struct.ac::m"* @_ZN2ac1mC1EPc(%"struct.ac::m"* nonnull %n.i.i12, i8* null), !dbg !153 60 %call2.i.i14 = call i8* @_ZN2ac2adEv(%class.ac* nonnull %u.i11), !dbg !153 61 %cmp.i.i15 = icmp eq i8* %call2.i.i14, null, !dbg !153 62 %frombool.i.i16 = zext i1 %cmp.i.i15 to i8, !dbg !153 63 store i8 %frombool.i.i16, i8* @l, align 1, !dbg !153 64 br i1 %cmp.i.i15, label %_ZN1yC2Ev.exit18, label %if.then.i.i17, !dbg !153 65 66if.then.i.i17: ; preds = %if.then4 67 call void @_ZdlPv(i8* null), !dbg !170 68 br label %_ZN1yC2Ev.exit18, !dbg !170 69 70_ZN1yC2Ev.exit18: ; preds = %if.then4, %if.then.i.i17 71 call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %3), !dbg !173 72 br label %cleanup 73 74if.end7: ; preds = %if.end 75 %4 = getelementptr inbounds %class.ae, %class.ae* %c, i32 0, i32 0, !dbg !173 76 call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %4), !dbg !173 77 %call8 = call %class.ae* @_ZN2aeC1Ei(%class.ae* nonnull %c, i32 1), !dbg !173 78 call void @_ZN2ae1xES_(%class.ae* nonnull %c, [1 x i32] zeroinitializer), !dbg !173 79 call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %4), !dbg !173 80 br label %cleanup 81 82cleanup: ; preds = %if.end7, %_ZN1yC2Ev.exit18, %_ZN1yC2Ev.exit 83 %retval.0 = phi i1 [ true, %_ZN1yC2Ev.exit ], [ true, %_ZN1yC2Ev.exit18 ], [ false, %if.end7 ], !dbg !75 84 ret i1 %retval.0, !dbg !75 85} 86 87; Function Attrs: argmemonly nounwind willreturn 88declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) 89 90; Function Attrs: argmemonly nounwind willreturn 91declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) 92 93declare dso_local %class.ae* @_ZN2aeC1Ei(%class.ae* returned, i32) unnamed_addr 94 95declare dso_local void @_ZN2ae1xES_(%class.ae*, [1 x i32]) local_unnamed_addr 96 97declare dso_local %"struct.ac::m"* @_ZN2ac1mC1EPc(%"struct.ac::m"* returned, i8*) unnamed_addr 98 99declare dso_local i8* @_ZN2ac2adEv(%class.ac*) local_unnamed_addr 100 101; Function Attrs: nobuiltin nounwind 102declare !dbg !6 dso_local void @_ZdlPv(i8*) local_unnamed_addr 103 104; Function Attrs: nounwind readnone speculatable willreturn 105declare void @llvm.dbg.value(metadata, metadata, metadata) 106 107!llvm.dbg.cu = !{!2} 108!llvm.module.flags = !{!12, !13, !14, !15} 109!llvm.ident = !{!16} 110 111!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 112!1 = distinct !DIGlobalVariable(name: "l", scope: !2, file: !3, line: 14, type: !11, isLocal: false, isDefinition: true) 113!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !10, splitDebugInlining: false, nameTableKind: None) 114!3 = !DIFile(filename: "crash.cpp", directory: "/") 115!4 = !{} 116!5 = !{!6} 117!6 = !DISubprogram(name: "operator delete", linkageName: "_ZdlPv", scope: !3, file: !3, type: !7, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4) 118!7 = !DISubroutineType(types: !8) 119!8 = !{null, !9} 120!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 32) 121!10 = !{!0} 122!11 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) 123!12 = !{i32 7, !"Dwarf Version", i32 4} 124!13 = !{i32 2, !"Debug Info Version", i32 3} 125!14 = !{i32 1, !"wchar_size", i32 4} 126!15 = !{i32 1, !"min_enum_size", i32 4} 127!16 = !{!"clang version 11.0.0"} 128!17 = distinct !DISubprogram(name: "ag", linkageName: "_ZN1z2agEv", scope: !18, file: !3, line: 45, type: !24, scopeLine: 45, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !23, retainedNodes: !27) 129!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "z", file: !3, line: 40, size: 16, flags: DIFlagTypePassByValue, elements: !19, identifier: "_ZTS1z") 130!19 = !{!20, !22, !23} 131!20 = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: !18, file: !3, line: 42, baseType: !21, size: 8) 132!21 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char) 133!22 = !DIDerivedType(tag: DW_TAG_member, name: "ah", scope: !18, file: !3, line: 43, baseType: !21, size: 8, offset: 8) 134!23 = !DISubprogram(name: "ag", linkageName: "_ZN1z2agEv", scope: !18, file: !3, line: 41, type: !24, scopeLine: 41, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) 135!24 = !DISubroutineType(types: !25) 136!25 = !{!11, !26} 137!26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !18, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 138!27 = !{!28, !30, !31, !32, !55, !58} 139!28 = !DILocalVariable(name: "this", arg: 1, scope: !17, type: !29, flags: DIFlagArtificial | DIFlagObjectPointer) 140!29 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !18, size: 32) 141!30 = !DILocalVariable(name: "w", scope: !17, file: !3, line: 46, type: !11) 142!31 = !DILocalVariable(name: "v", scope: !17, file: !3, line: 46, type: !11) 143!32 = !DILocalVariable(name: "a", scope: !33, file: !3, line: 48, type: !35) 144!33 = distinct !DILexicalBlock(scope: !34, file: !3, line: 47, column: 10) 145!34 = distinct !DILexicalBlock(scope: !17, file: !3, line: 47, column: 7) 146!35 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "y", file: !3, line: 37, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !36, identifier: "_ZTS1y") 147!36 = !{!37} 148!37 = !DIDerivedType(tag: DW_TAG_member, name: "u", scope: !35, file: !3, line: 38, baseType: !38, size: 8) 149!38 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "ac", file: !3, line: 15, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !39, identifier: "_ZTS2ac") 150!39 = !{!40, !48, !52} 151!40 = !DIDerivedType(tag: DW_TAG_member, name: "n", scope: !38, file: !3, line: 18, baseType: !41, size: 8) 152!41 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "m", scope: !38, file: !3, line: 16, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !42, identifier: "_ZTSN2ac1mE") 153!42 = !{!43} 154!43 = !DISubprogram(name: "m", scope: !41, file: !3, line: 17, type: !44, scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) 155!44 = !DISubroutineType(types: !45) 156!45 = !{null, !46, !47} 157!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !41, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 158!47 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 32) 159!48 = !DISubprogram(name: "ad", linkageName: "_ZN2ac2adEv", scope: !38, file: !3, line: 19, type: !49, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized) 160!49 = !DISubroutineType(types: !50) 161!50 = !{!47, !51} 162!51 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !38, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 163!52 = !DISubprogram(name: "ac", scope: !38, file: !3, line: 22, type: !53, scopeLine: 22, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 164!53 = !DISubroutineType(types: !54) 165!54 = !{null, !51} 166!55 = !DILocalVariable(name: "b", scope: !56, file: !3, line: 53, type: !35) 167!56 = distinct !DILexicalBlock(scope: !57, file: !3, line: 52, column: 11) 168!57 = distinct !DILexicalBlock(scope: !17, file: !3, line: 52, column: 7) 169!58 = !DILocalVariable(name: "c", scope: !17, file: !3, line: 57, type: !59) 170!59 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "ae", file: !3, line: 30, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !60, identifier: "_ZTS2ae") 171!60 = !{!61, !62, !68, !72} 172!61 = !DIDerivedType(tag: DW_TAG_member, name: "af", scope: !59, file: !3, line: 32, baseType: !21, size: 8, flags: DIFlagPublic) 173!62 = !DISubprogram(name: "ae", scope: !59, file: !3, line: 33, type: !63, scopeLine: 33, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 174!63 = !DISubroutineType(types: !64) 175!64 = !{null, !65, !66} 176!65 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !59, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 177!66 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !67, size: 32) 178!67 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21) 179!68 = !DISubprogram(name: "ae", scope: !59, file: !3, line: 34, type: !69, scopeLine: 34, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 180!69 = !DISubroutineType(types: !70) 181!70 = !{null, !65, !71} 182!71 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 183!72 = !DISubprogram(name: "x", linkageName: "_ZN2ae1xES_", scope: !59, file: !3, line: 35, type: !73, scopeLine: 35, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 184!73 = !DISubroutineType(types: !74) 185!74 = !{null, !65, !59} 186!75 = !DILocation(line: 0, scope: !17) 187!82 = !DILocation(line: 48, column: 5, scope: !33) 188!84 = !DILocalVariable(name: "this", arg: 1, scope: !85, type: !91, flags: DIFlagArtificial | DIFlagObjectPointer) 189!85 = distinct !DISubprogram(name: "y", linkageName: "_ZN1yC2Ev", scope: !35, file: !3, line: 37, type: !86, scopeLine: 37, flags: DIFlagArtificial | DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !89, retainedNodes: !90) 190!86 = !DISubroutineType(types: !87) 191!87 = !{null, !88} 192!88 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !35, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 193!89 = !DISubprogram(name: "y", scope: !35, type: !86, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagOptimized) 194!90 = !{!84} 195!91 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !35, size: 32) 196!93 = distinct !DILocation(line: 48, column: 7, scope: !33) 197!94 = !DILocation(line: 37, column: 8, scope: !85, inlinedAt: !93) 198!95 = !DILocalVariable(name: "this", arg: 1, scope: !96, type: !114, flags: DIFlagArtificial | DIFlagObjectPointer) 199!96 = distinct !DISubprogram(name: "ac", linkageName: "_ZN2acC2Ev", scope: !38, file: !3, line: 22, type: !53, scopeLine: 22, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !52, retainedNodes: !97) 200!97 = !{!95, !98} 201!98 = !DILocalVariable(name: "t", scope: !99, file: !3, line: 25, type: !102) 202!99 = distinct !DILexicalBlock(scope: !100, file: !3, line: 24, column: 13) 203!100 = distinct !DILexicalBlock(scope: !101, file: !3, line: 24, column: 9) 204!101 = distinct !DILexicalBlock(scope: !96, file: !3, line: 22, column: 15) 205!102 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "o<char>", file: !3, line: 6, size: 8, flags: DIFlagTypePassByValue, elements: !103, templateParams: !112, identifier: "_ZTS1oIcE") 206!103 = !{!104} 207!104 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !102, baseType: !105, flags: DIFlagPublic, extraData: i32 0) 208!105 = !DIDerivedType(tag: DW_TAG_typedef, name: "d<char>", file: !3, line: 5, baseType: !106) 209!106 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "i", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !107, identifier: "_ZTS1i") 210!107 = !{!108} 211!108 = !DISubprogram(name: "j", linkageName: "_ZN1i1jEPci", scope: !106, file: !3, line: 3, type: !109, scopeLine: 3, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized) 212!109 = !DISubroutineType(types: !110) 213!110 = !{null, !111, !47, !71} 214!111 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !106, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 215!112 = !{!113} 216!113 = !DITemplateTypeParameter(type: !21) 217!114 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !38, size: 32) 218!116 = distinct !DILocation(line: 37, column: 8, scope: !85, inlinedAt: !93) 219!124 = !DILocalVariable(name: "k", arg: 1, scope: !125, file: !3, line: 10, type: !102) 220!125 = distinct !DISubprogram(name: "p", linkageName: "_ZN2aaI1oIcEE1pES1_Pci", scope: !126, file: !3, line: 10, type: !129, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !128, retainedNodes: !133) 221!126 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "aa<o<char> >", file: !3, line: 9, size: 8, flags: DIFlagTypePassByValue, elements: !127, templateParams: !131, identifier: "_ZTS2aaI1oIcEE") 222!127 = !{!128} 223!128 = !DISubprogram(name: "p", linkageName: "_ZN2aaI1oIcEE1pES1_Pci", scope: !126, file: !3, line: 10, type: !129, scopeLine: 10, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: DISPFlagOptimized) 224!129 = !DISubroutineType(types: !130) 225!130 = !{null, !102, !47, !71} 226!131 = !{!132} 227!132 = !DITemplateTypeParameter(type: !102) 228!133 = !{!124, !134, !135} 229!134 = !DILocalVariable(name: "ab", arg: 2, scope: !125, file: !3, line: 10, type: !47) 230!135 = !DILocalVariable(name: "q", arg: 3, scope: !125, file: !3, line: 10, type: !71) 231!136 = !DILocation(line: 10, column: 22, scope: !125, inlinedAt: !137) 232!137 = distinct !DILocation(line: 26, column: 7, scope: !99, inlinedAt: !116) 233!138 = !DILocation(line: 0, scope: !125, inlinedAt: !137) 234!139 = !DILocalVariable(name: "k", arg: 2, scope: !140, file: !3, line: 3, type: !47) 235!140 = distinct !DISubprogram(name: "j", linkageName: "_ZN1i1jEPci", scope: !106, file: !3, line: 3, type: !109, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, declaration: !108, retainedNodes: !141) 236!141 = !{!142, !139, !144} 237!142 = !DILocalVariable(name: "this", arg: 1, scope: !140, type: !143, flags: DIFlagArtificial | DIFlagObjectPointer) 238!143 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !106, size: 32) 239!144 = !DILocalVariable(arg: 3, scope: !140, file: !3, line: 3, type: !71) 240!145 = !DILocation(line: 0, scope: !140, inlinedAt: !146) 241!146 = distinct !DILocation(line: 10, column: 43, scope: !125, inlinedAt: !137) 242!150 = !DILocation(line: 52, column: 7, scope: !57) 243!153 = !DILocation(line: 53, column: 5, scope: !56) 244!156 = distinct !DILocation(line: 53, column: 7, scope: !56) 245!159 = distinct !DILocation(line: 37, column: 8, scope: !85, inlinedAt: !156) 246!166 = distinct !DILocation(line: 26, column: 7, scope: !99, inlinedAt: !159) 247!167 = !DILocation(line: 0, scope: !125, inlinedAt: !166) 248!169 = distinct !DILocation(line: 10, column: 43, scope: !125, inlinedAt: !166) 249!170 = !DILocation(line: 3, column: 26, scope: !140, inlinedAt: !169) 250!173 = !DILocation(line: 57, column: 3, scope: !17) 251