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