1 ; RUN: llc -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s 2 ; Test that a variable with multiple entries in the MMI table makes it into the 3 ; debug info. 4 ; 5 ; CHECK: DW_TAG_inlined_subroutine 6 ; CHECK: "_Z3f111A" 7 ; CHECK: DW_TAG_formal_parameter 8 ; CHECK: DW_AT_location [DW_FORM_block1] (<0x0b> 91 51 9d 78 08 91 4a 9d 38 88 01 ) 9 ; -- fbreg -47, bit-piece 120 8 , fbreg -54, bit-piece 56 136 ------^ 10 ; CHECK: DW_AT_abstract_origin {{.*}} "p1" 11 ; 12 ; long a; 13 ; struct A { 14 ; bool x4; 15 ; void *x5; 16 ; bool x6; 17 ; }; 18 ; int *b; 19 ; struct B { 20 ; B(long); 21 ; ~B(); 22 ; }; 23 ; void f9(A); 24 ; void f13(A p1) { 25 ; b = (int *)__builtin_operator_new(a); 26 ; f9(p1); 27 ; } 28 ; void f11(A p1) { f13(p1); } 29 ; void f16() { 30 ; A c; 31 ; B d(a); 32 ; c.x6 = c.x4 = true; 33 ; f11(c); 34 ; } 35 ; ModuleID = 'test.cpp' 36 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 37 target triple = "aarch64-apple-ios" 38 39 %struct.A = type { i8, i8*, i8 } 40 %struct.B = type { i8 } 41 42 @a = global i64 0, align 8 43 @b = global i32* null, align 8 44 45 define void @_Z3f131A(%struct.A* nocapture readonly %p1) #0 !dbg !25 { 46 entry: 47 %agg.tmp = alloca %struct.A, align 8 48 tail call void @llvm.dbg.declare(metadata %struct.A* %p1, metadata !30, metadata !46), !dbg !47 49 %0 = load i64, i64* @a, align 8, !dbg !48, !tbaa !49 50 %call = tail call noalias i8* @_Znwm(i64 %0) #5, !dbg !53 51 store i8* %call, i8** bitcast (i32** @b to i8**), align 8, !dbg !54, !tbaa !55 52 %1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp, i64 0, i32 0, !dbg !57 53 %2 = getelementptr inbounds %struct.A, %struct.A* %p1, i64 0, i32 0, !dbg !57 54 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 24, i32 8, i1 false), !dbg !57, !tbaa.struct !58 55 call void @_Z2f91A(%struct.A* %agg.tmp), !dbg !61 56 ret void, !dbg !62 57 } 58 59 ; Function Attrs: nounwind readnone 60 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 61 62 ; Function Attrs: nobuiltin 63 declare noalias i8* @_Znwm(i64) #2 64 65 declare void @_Z2f91A(%struct.A*) #0 66 67 ; Function Attrs: nounwind 68 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3 69 70 define void @_Z3f111A(%struct.A* nocapture readonly %p1) #0 !dbg !31 { 71 entry: 72 %agg.tmp.i = alloca %struct.A, align 8 73 tail call void @llvm.dbg.declare(metadata %struct.A* %p1, metadata !33, metadata !46), !dbg !63 74 %0 = getelementptr inbounds %struct.A, %struct.A* %p1, i64 0, i32 0, !dbg !64 75 %1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i, i64 0, i32 0, !dbg !65 76 call void @llvm.lifetime.start(i64 24, i8* %1), !dbg !65 77 %2 = load i64, i64* @a, align 8, !dbg !67, !tbaa !49 78 %call.i = tail call noalias i8* @_Znwm(i64 %2) #5, !dbg !68 79 store i8* %call.i, i8** bitcast (i32** @b to i8**), align 8, !dbg !69, !tbaa !55 80 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %0, i64 24, i32 8, i1 false), !dbg !70 81 call void @_Z2f91A(%struct.A* %agg.tmp.i), !dbg !71 82 call void @llvm.lifetime.end(i64 24, i8* %1), !dbg !72 83 ret void, !dbg !73 84 } 85 86 define void @_Z3f16v() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !34 { 87 entry: 88 %agg.tmp.i.i = alloca %struct.A, align 8 89 %d = alloca %struct.B, align 1 90 %agg.tmp.sroa.2 = alloca [15 x i8], align 1 91 %agg.tmp.sroa.4 = alloca [7 x i8], align 1 92 tail call void @llvm.dbg.declare(metadata [15 x i8]* %agg.tmp.sroa.2, metadata !74, metadata !76), !dbg !77 93 tail call void @llvm.dbg.declare(metadata [7 x i8]* %agg.tmp.sroa.4, metadata !74, metadata !78), !dbg !77 94 tail call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !38, metadata !79), !dbg !80 95 %0 = load i64, i64* @a, align 8, !dbg !81, !tbaa !49 96 tail call void @llvm.dbg.value(metadata %struct.B* %d, i64 0, metadata !39, metadata !79), !dbg !82 97 %call = call %struct.B* @_ZN1BC1El(%struct.B* %d, i64 %0), !dbg !82 98 call void @llvm.dbg.value(metadata i8 1, i64 0, metadata !38, metadata !83), !dbg !80 99 call void @llvm.dbg.value(metadata i8 1, i64 0, metadata !38, metadata !84), !dbg !80 100 call void @llvm.dbg.value(metadata i8 1, i64 0, metadata !74, metadata !83), !dbg !77 101 call void @llvm.dbg.value(metadata i8 1, i64 0, metadata !74, metadata !84), !dbg !77 102 call void @llvm.dbg.declare(metadata %struct.A* undef, metadata !74, metadata !46), !dbg !77 103 %1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i.i, i64 0, i32 0, !dbg !85 104 call void @llvm.lifetime.start(i64 24, i8* %1), !dbg !85 105 %2 = load i64, i64* @a, align 8, !dbg !87, !tbaa !49 106 %call.i.i5 = invoke noalias i8* @_Znwm(i64 %2) #5 107 to label %call.i.i.noexc unwind label %lpad, !dbg !88 108 109 call.i.i.noexc: ; preds = %entry 110 %agg.tmp.sroa.4.17..sroa_idx = getelementptr inbounds [7 x i8], [7 x i8]* %agg.tmp.sroa.4, i64 0, i64 0, !dbg !89 111 %agg.tmp.sroa.2.1..sroa_idx = getelementptr inbounds [15 x i8], [15 x i8]* %agg.tmp.sroa.2, i64 0, i64 0, !dbg !89 112 store i8* %call.i.i5, i8** bitcast (i32** @b to i8**), align 8, !dbg !90, !tbaa !55 113 store i8 1, i8* %1, align 8, !dbg !91 114 %agg.tmp.sroa.2.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 1, !dbg !91 115 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.2.0..sroa_raw_idx, i8* %agg.tmp.sroa.2.1..sroa_idx, i64 15, i32 1, i1 false), !dbg !91 116 %agg.tmp.sroa.3.0..sroa_idx = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i.i, i64 0, i32 2, !dbg !91 117 store i8 1, i8* %agg.tmp.sroa.3.0..sroa_idx, align 8, !dbg !91 118 %agg.tmp.sroa.4.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 17, !dbg !91 119 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.4.0..sroa_raw_idx, i8* %agg.tmp.sroa.4.17..sroa_idx, i64 7, i32 1, i1 false), !dbg !91 120 invoke void @_Z2f91A(%struct.A* %agg.tmp.i.i) 121 to label %invoke.cont unwind label %lpad, !dbg !92 122 123 invoke.cont: ; preds = %call.i.i.noexc 124 call void @llvm.lifetime.end(i64 24, i8* %1), !dbg !93 125 call void @llvm.dbg.value(metadata %struct.B* %d, i64 0, metadata !39, metadata !79), !dbg !82 126 %call1 = call %struct.B* @_ZN1BD1Ev(%struct.B* %d) #3, !dbg !94 127 ret void, !dbg !94 128 129 lpad: ; preds = %call.i.i.noexc, %entry 130 %3 = landingpad { i8*, i32 } 131 cleanup, !dbg !94 132 call void @llvm.dbg.value(metadata %struct.B* %d, i64 0, metadata !39, metadata !79), !dbg !82 133 %call2 = call %struct.B* @_ZN1BD1Ev(%struct.B* %d) #3, !dbg !94 134 resume { i8*, i32 } %3, !dbg !94 135 } 136 137 declare %struct.B* @_ZN1BC1El(%struct.B*, i64) 138 139 declare i32 @__gxx_personality_v0(...) 140 141 ; Function Attrs: nounwind 142 declare %struct.B* @_ZN1BD1Ev(%struct.B*) #4 143 144 ; Function Attrs: nounwind readnone 145 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 146 147 ; Function Attrs: nounwind 148 declare void @llvm.lifetime.start(i64, i8* nocapture) #3 149 150 ; Function Attrs: nounwind 151 declare void @llvm.lifetime.end(i64, i8* nocapture) #3 152 153 attributes #1 = { nounwind readnone } 154 attributes #2 = { nobuiltin } 155 attributes #3 = { nounwind } 156 attributes #4 = { nounwind } 157 attributes #5 = { builtin } 158 159 !llvm.dbg.cu = !{!0} 160 !llvm.module.flags = !{!43, !44} 161 !llvm.ident = !{!45} 162 163 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.7.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !24, globals: !40, imports: !2) 164 !1 = !DIFile(filename: "<stdin>", directory: "") 165 !2 = !{} 166 !3 = !{!4, !12, !14} 167 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 2, size: 192, align: 64, file: !5, elements: !6, identifier: "_ZTS1A") 168 !5 = !DIFile(filename: "test.cpp", directory: "") 169 !6 = !{!7, !9, !11} 170 !7 = !DIDerivedType(tag: DW_TAG_member, name: "x4", line: 3, size: 8, align: 8, file: !5, scope: !"_ZTS1A", baseType: !8) 171 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean) 172 !9 = !DIDerivedType(tag: DW_TAG_member, name: "x5", line: 4, size: 64, align: 64, offset: 64, file: !5, scope: !"_ZTS1A", baseType: !10) 173 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: null) 174 !11 = !DIDerivedType(tag: DW_TAG_member, name: "x6", line: 5, size: 8, align: 8, offset: 128, file: !5, scope: !"_ZTS1A", baseType: !8) 175 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13) 176 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 177 !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "B", line: 8, size: 8, align: 8, file: !5, elements: !15, identifier: "_ZTS1B") 178 !15 = !{!16, !21} 179 !16 = !DISubprogram(name: "B", line: 9, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 9, file: !5, scope: !"_ZTS1B", type: !17) 180 !17 = !DISubroutineType(types: !18) 181 !18 = !{null, !19, !20} 182 !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B") 183 !20 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed) 184 !21 = !DISubprogram(name: "~B", line: 10, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 10, file: !5, scope: !"_ZTS1B", type: !22) 185 !22 = !DISubroutineType(types: !23) 186 !23 = !{null, !19} 187 !24 = !{!25, !31, !34} 188 !25 = distinct !DISubprogram(name: "f13", linkageName: "_Z3f131A", line: 13, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 13, file: !5, scope: !26, type: !27, variables: !29) 189 !26 = !DIFile(filename: "test.cpp", directory: "") 190 !27 = !DISubroutineType(types: !28) 191 !28 = !{null, !"_ZTS1A"} 192 !29 = !{!30} 193 !30 = !DILocalVariable(name: "p1", line: 13, arg: 1, scope: !25, file: !26, type: !"_ZTS1A") 194 !31 = distinct !DISubprogram(name: "f11", linkageName: "_Z3f111A", line: 17, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 17, file: !5, scope: !26, type: !27, variables: !32) 195 !32 = !{!33} 196 !33 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A") 197 !34 = distinct !DISubprogram(name: "f16", linkageName: "_Z3f16v", line: 18, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 18, file: !5, scope: !26, type: !35, variables: !37) 198 !35 = !DISubroutineType(types: !36) 199 !36 = !{null} 200 !37 = !{!38, !39} 201 !38 = !DILocalVariable(name: "c", line: 19, scope: !34, file: !26, type: !"_ZTS1A") 202 !39 = !DILocalVariable(name: "d", line: 20, scope: !34, file: !26, type: !"_ZTS1B") 203 !40 = !{!41, !42} 204 !41 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !26, type: !20, variable: i64* @a) 205 !42 = !DIGlobalVariable(name: "b", line: 7, isLocal: false, isDefinition: true, scope: null, file: !26, type: !12, variable: i32** @b) 206 !43 = !{i32 2, !"Dwarf Version", i32 2} 207 !44 = !{i32 2, !"Debug Info Version", i32 3} 208 !45 = !{!"clang version 3.7.0 "} 209 !46 = !DIExpression(DW_OP_deref) 210 !47 = !DILocation(line: 13, column: 12, scope: !25) 211 !48 = !DILocation(line: 14, column: 37, scope: !25) 212 !49 = !{!50, !50, i64 0} 213 !50 = !{!"long", !51, i64 0} 214 !51 = !{!"omnipotent char", !52, i64 0} 215 !52 = !{!"Simple C/C++ TBAA"} 216 !53 = !DILocation(line: 14, column: 14, scope: !25) 217 !54 = !DILocation(line: 14, column: 5, scope: !25) 218 !55 = !{!56, !56, i64 0} 219 !56 = !{!"any pointer", !51, i64 0} 220 !57 = !DILocation(line: 15, column: 6, scope: !25) 221 !58 = !{i64 0, i64 1, !59, i64 8, i64 8, !55, i64 16, i64 1, !59} 222 !59 = !{!60, !60, i64 0} 223 !60 = !{!"bool", !51, i64 0} 224 !61 = !DILocation(line: 15, column: 3, scope: !25) 225 !62 = !DILocation(line: 16, column: 1, scope: !25) 226 !63 = !DILocation(line: 17, column: 12, scope: !31) 227 !64 = !DILocation(line: 17, column: 22, scope: !31) 228 !65 = !DILocation(line: 13, column: 12, scope: !25, inlinedAt: !66) 229 !66 = distinct !DILocation(line: 17, column: 18, scope: !31) 230 !67 = !DILocation(line: 14, column: 37, scope: !25, inlinedAt: !66) 231 !68 = !DILocation(line: 14, column: 14, scope: !25, inlinedAt: !66) 232 !69 = !DILocation(line: 14, column: 5, scope: !25, inlinedAt: !66) 233 !70 = !DILocation(line: 15, column: 6, scope: !25, inlinedAt: !66) 234 !71 = !DILocation(line: 15, column: 3, scope: !25, inlinedAt: !66) 235 !72 = !DILocation(line: 16, column: 1, scope: !25, inlinedAt: !66) 236 !73 = !DILocation(line: 17, column: 27, scope: !31) 237 !74 = !DILocalVariable(name: "p1", line: 17, arg: 1, scope: !31, file: !26, type: !"_ZTS1A") 238 !75 = distinct !DILocation(line: 22, column: 3, scope: !34) 239 !76 = !DIExpression(DW_OP_bit_piece, 8, 120) 240 !77 = !DILocation(line: 17, column: 12, scope: !31, inlinedAt: !75) 241 !78 = !DIExpression(DW_OP_bit_piece, 136, 56) 242 !79 = !DIExpression() 243 !80 = !DILocation(line: 19, column: 5, scope: !34) 244 !81 = !DILocation(line: 20, column: 7, scope: !34) 245 !82 = !DILocation(line: 20, column: 5, scope: !34) 246 !83 = !DIExpression(DW_OP_bit_piece, 0, 8) 247 !84 = !DIExpression(DW_OP_bit_piece, 128, 8) 248 !85 = !DILocation(line: 13, column: 12, scope: !25, inlinedAt: !86) 249 !86 = distinct !DILocation(line: 17, column: 18, scope: !31, inlinedAt: !75) 250 !87 = !DILocation(line: 14, column: 37, scope: !25, inlinedAt: !86) 251 !88 = !DILocation(line: 14, column: 14, scope: !25, inlinedAt: !86) 252 !89 = !DILocation(line: 22, column: 7, scope: !34) 253 !90 = !DILocation(line: 14, column: 5, scope: !25, inlinedAt: !86) 254 !91 = !DILocation(line: 15, column: 6, scope: !25, inlinedAt: !86) 255 !92 = !DILocation(line: 15, column: 3, scope: !25, inlinedAt: !86) 256 !93 = !DILocation(line: 16, column: 1, scope: !25, inlinedAt: !86) 257 !94 = !DILocation(line: 23, column: 1, scope: !34) 258