257 lines · plain
1; RUN: llc -frame-pointer=all -O0 -fast-isel -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s2; Test that a variable with multiple entries in the MMI table makes it into the3; debug info.4;5; CHECK: DW_TAG_inlined_subroutine6; CHECK: "_Z3f111A"7; CHECK: DW_TAG_formal_parameter8; 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_breg31 WSP+42, 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, ptr, i8 }40%struct.B = type { i8 }41 42@a = global i64 0, align 8, !dbg !043@b = global ptr null, align 8, !dbg !444 45define void @_Z3f131A(ptr nocapture readonly %p1) !dbg !32 {46entry:47 %agg.tmp = alloca %struct.A, align 848 tail call void @llvm.dbg.declare(metadata ptr %p1, metadata !36, metadata !37), !dbg !3849 %0 = load i64, ptr @a, align 8, !dbg !39, !tbaa !4050 %call = tail call noalias ptr @_Znwm(i64 %0) #4, !dbg !4451 store ptr %call, ptr @b, align 8, !dbg !45, !tbaa !4652 %1 = getelementptr inbounds %struct.A, ptr %agg.tmp, i64 0, i32 0, !dbg !4853 %2 = getelementptr inbounds %struct.A, ptr %p1, i64 0, i32 0, !dbg !4854 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %1, ptr align 8 %2, i64 24, i1 false), !dbg !48, !tbaa.struct !4955 call void @_Z2f91A(ptr %agg.tmp), !dbg !5256 ret void, !dbg !5357}58 59; Function Attrs: nounwind readnone60declare void @llvm.dbg.declare(metadata, metadata, metadata) #061 62; Function Attrs: nobuiltin63declare noalias ptr @_Znwm(i64) #164 65declare void @_Z2f91A(ptr)66 67; Function Attrs: argmemonly nounwind68declare void @llvm.memcpy.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1) #269 70define void @_Z3f111A(ptr nocapture readonly %p1) !dbg !54 {71entry:72 %agg.tmp.i = alloca %struct.A, align 873 tail call void @llvm.dbg.declare(metadata ptr %p1, metadata !56, metadata !37), !dbg !5774 %0 = getelementptr inbounds %struct.A, ptr %p1, i64 0, i32 0, !dbg !5875 %1 = getelementptr inbounds %struct.A, ptr %agg.tmp.i, i64 0, i32 0, !dbg !5976 call void @llvm.lifetime.start(i64 24, ptr %1), !dbg !5977 %2 = load i64, ptr @a, align 8, !dbg !61, !tbaa !4078 %call.i = tail call noalias ptr @_Znwm(i64 %2) #4, !dbg !6279 store ptr %call.i, ptr @b, align 8, !dbg !63, !tbaa !4680 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %1, ptr align 8 %0, i64 24, i1 false), !dbg !6481 call void @_Z2f91A(ptr %agg.tmp.i), !dbg !6582 call void @llvm.lifetime.end(i64 24, ptr %1), !dbg !6683 ret void, !dbg !6784}85 86define void @_Z3f16v() personality ptr @__gxx_personality_v0 !dbg !68 {87entry:88 %agg.tmp.i.i = alloca %struct.A, align 889 %d = alloca %struct.B, align 890 %agg.tmp.sroa.2 = alloca [15 x i8], align 191 %agg.tmp.sroa.4 = alloca [7 x i8], align 192 tail call void @llvm.dbg.declare(metadata ptr %agg.tmp.sroa.2, metadata !56, metadata !74), !dbg !7593 tail call void @llvm.dbg.declare(metadata ptr %agg.tmp.sroa.4, metadata !56, metadata !77), !dbg !7594 tail call void @llvm.dbg.declare(metadata ptr undef, metadata !72, metadata !37), !dbg !7895 %0 = load i64, ptr @a, align 8, !dbg !79, !tbaa !4096 tail call void @llvm.dbg.value(metadata ptr %d, metadata !73, metadata !37), !dbg !8097 %call = call ptr @_ZN1BC1El(ptr %d, i64 %0), !dbg !8098 call void @llvm.dbg.value(metadata i8 1, metadata !72, metadata !81), !dbg !7899 call void @llvm.dbg.value(metadata i8 1, metadata !72, metadata !82), !dbg !78100 call void @llvm.dbg.value(metadata i8 1, metadata !56, metadata !81), !dbg !75101 call void @llvm.dbg.value(metadata i8 1, metadata !56, metadata !82), !dbg !75102 call void @llvm.dbg.declare(metadata ptr undef, metadata !56, metadata !37), !dbg !75103 %1 = getelementptr inbounds %struct.A, ptr %agg.tmp.i.i, i64 0, i32 0, !dbg !83104 call void @llvm.lifetime.start(i64 24, ptr %1), !dbg !83105 %2 = load i64, ptr @a, align 8, !dbg !85, !tbaa !40106 %call.i.i5 = invoke noalias ptr @_Znwm(i64 %2) #4107 to label %call.i.i.noexc unwind label %lpad, !dbg !86108 109call.i.i.noexc: ; preds = %entry110 %agg.tmp.sroa.4.17..sroa_idx = getelementptr inbounds [7 x i8], ptr %agg.tmp.sroa.4, i64 0, i64 0, !dbg !87111 %agg.tmp.sroa.2.1..sroa_idx = getelementptr inbounds [15 x i8], ptr %agg.tmp.sroa.2, i64 0, i64 0, !dbg !87112 store ptr %call.i.i5, ptr @b, align 8, !dbg !88, !tbaa !46113 store i8 1, ptr %1, align 8, !dbg !89114 %agg.tmp.sroa.2.0..sroa_raw_idx = getelementptr inbounds i8, ptr %1, i64 1, !dbg !89115 call void @llvm.memcpy.p0.p0.i64(ptr %agg.tmp.sroa.2.0..sroa_raw_idx, ptr %agg.tmp.sroa.2.1..sroa_idx, i64 15, i1 false), !dbg !89116 %agg.tmp.sroa.3.0..sroa_idx = getelementptr inbounds %struct.A, ptr %agg.tmp.i.i, i64 0, i32 2, !dbg !89117 store i8 1, ptr %agg.tmp.sroa.3.0..sroa_idx, align 8, !dbg !89118 %agg.tmp.sroa.4.0..sroa_raw_idx = getelementptr inbounds i8, ptr %1, i64 17, !dbg !89119 call void @llvm.memcpy.p0.p0.i64(ptr %agg.tmp.sroa.4.0..sroa_raw_idx, ptr %agg.tmp.sroa.4.17..sroa_idx, i64 7, i1 false), !dbg !89120 invoke void @_Z2f91A(ptr %agg.tmp.i.i)121 to label %invoke.cont unwind label %lpad, !dbg !90122 123invoke.cont: ; preds = %call.i.i.noexc124 call void @llvm.lifetime.end(i64 24, ptr %1), !dbg !91125 call void @llvm.dbg.value(metadata ptr %d, metadata !73, metadata !37), !dbg !80126 %call1 = call ptr @_ZN1BD1Ev(ptr %d) #3, !dbg !92127 ret void, !dbg !92128 129lpad: ; preds = %call.i.i.noexc, %entry130 %3 = landingpad { ptr, i32 }131 cleanup, !dbg !92132 call void @llvm.dbg.value(metadata ptr %d, metadata !73, metadata !37), !dbg !80133 %call2 = call ptr @_ZN1BD1Ev(ptr %d) #3, !dbg !92134 resume { ptr, i32 } %3, !dbg !92135}136 137declare ptr @_ZN1BC1El(ptr, i64)138 139declare i32 @__gxx_personality_v0(...)140 141; Function Attrs: nounwind142declare ptr @_ZN1BD1Ev(ptr) #3143 144; Function Attrs: nounwind readnone145declare void @llvm.dbg.value(metadata, metadata, metadata) #0146 147; Function Attrs: argmemonly nounwind148declare void @llvm.lifetime.start(i64, ptr nocapture) #2149 150; Function Attrs: argmemonly nounwind151declare void @llvm.lifetime.end(i64, ptr nocapture) #2152 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