119 lines
6.3 KiB
YAML
119 lines
6.3 KiB
YAML
# RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
|
|
|
|
# Based on the following C++ code:
|
|
# struct A { A(A &) {} };
|
|
# struct B { A a; };
|
|
# struct C { C(B); };
|
|
# struct D : C { D(B); };
|
|
# D::D(B b) : C(b) {}
|
|
|
|
# Reproducer for PR44275. Ideally we should get an entry value location list
|
|
# entry for the reference parameter b, but we are currently not able to do that
|
|
# due to limitations in the DWARF emission code, which puts restrictions on the
|
|
# DIExpression. For now verify that we don't crash when trying to add such an
|
|
# entry value.
|
|
|
|
# CHECK: DW_AT_location
|
|
# CHECK-NEXT: [{{0x[0-9a-f]+}}, {{0x[0-9a-f]+}}): DW_OP_reg5 RDI
|
|
# CHECK-NEXT: [{{0x[0-9a-f]+}}, {{0x[0-9a-f]+}}): DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
|
|
# CHECK-NEXT: DW_AT_name ("this")
|
|
|
|
# CHECK: DW_AT_location
|
|
# CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg4 RSI+0)
|
|
# TODO: Here we should ideally get a location list entry using an entry value.
|
|
# CHECK-NEXT: DW_AT_name ("b")
|
|
|
|
--- |
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
%struct.D = type { i8 }
|
|
%struct.B = type { %struct.A }
|
|
%struct.A = type { i8 }
|
|
%struct.C = type { i8 }
|
|
|
|
@_ZN1DC1E1B = dso_local unnamed_addr alias void (%struct.D*, %struct.B*), void (%struct.D*, %struct.B*)* @_ZN1DC2E1B
|
|
; Function Attrs: uwtable
|
|
define dso_local void @_ZN1DC2E1B(%struct.D* %this, %struct.B* nocapture readnone %b) unnamed_addr #0 align 2 !dbg !7 {
|
|
entry:
|
|
%agg.tmp = alloca %struct.B, align 1
|
|
call void @llvm.dbg.value(metadata %struct.D* %this, metadata !32, metadata !DIExpression()), !dbg !35
|
|
call void @llvm.dbg.declare(metadata %struct.B* %b, metadata !34, metadata !DIExpression()), !dbg !36
|
|
%0 = bitcast %struct.D* %this to %struct.C*, !dbg !36
|
|
call void @_ZN1CC2E1B(%struct.C* %0, %struct.B* nonnull %agg.tmp), !dbg !36
|
|
ret void, !dbg !36
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone speculatable willreturn
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|
|
|
declare dso_local void @_ZN1CC2E1B(%struct.C*, %struct.B*) unnamed_addr
|
|
|
|
; Function Attrs: nounwind readnone speculatable willreturn
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
|
|
|
|
attributes #0 = { uwtable }
|
|
attributes #1 = { nounwind readnone speculatable willreturn }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4, !5}
|
|
!llvm.ident = !{!6}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
|
|
!1 = !DIFile(filename: "foo.cpp", directory: "/")
|
|
!2 = !{}
|
|
!3 = !{i32 7, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{!"clang version 10.0.0"}
|
|
!7 = distinct !DISubprogram(name: "D", linkageName: "_ZN1DC2E1B", scope: !8, file: !1, line: 5, type: !28, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !27, retainedNodes: !31)
|
|
!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !9, identifier: "_ZTS1D")
|
|
!9 = !{!10, !27}
|
|
!10 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !8, baseType: !11, extraData: i32 0)
|
|
!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !1, line: 3, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !12, identifier: "_ZTS1C")
|
|
!12 = !{!13}
|
|
!13 = !DISubprogram(name: "C", scope: !11, file: !1, line: 3, type: !14, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
|
|
!14 = !DISubroutineType(types: !15)
|
|
!15 = !{null, !16, !17}
|
|
!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !1, line: 2, size: 8, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !18, identifier: "_ZTS1B")
|
|
!18 = !{!19}
|
|
!19 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !17, file: !1, line: 2, baseType: !20, size: 8)
|
|
!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 1, size: 8, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !21, identifier: "_ZTS1A")
|
|
!21 = !{!22}
|
|
!22 = !DISubprogram(name: "A", scope: !20, file: !1, line: 1, type: !23, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
|
|
!23 = !DISubroutineType(types: !24)
|
|
!24 = !{null, !25, !26}
|
|
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
!26 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !20, size: 64)
|
|
!27 = !DISubprogram(name: "D", scope: !8, file: !1, line: 4, type: !28, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
|
|
!28 = !DISubroutineType(types: !29)
|
|
!29 = !{null, !30, !17}
|
|
!30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
!31 = !{!32, !34}
|
|
!32 = !DILocalVariable(name: "this", arg: 1, scope: !7, type: !33, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
!33 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
|
|
!34 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 5, type: !17)
|
|
!35 = !DILocation(line: 0, scope: !7)
|
|
!36 = !DILocation(line: 5, scope: !7)
|
|
|
|
...
|
|
---
|
|
name: _ZN1DC2E1B
|
|
body: |
|
|
bb.0.entry:
|
|
liveins: $rdi
|
|
|
|
DBG_VALUE $rdi, $noreg, !32, !DIExpression(), debug-location !35
|
|
DBG_VALUE $rsi, $noreg, !34, !DIExpression(DW_OP_deref), debug-location !36
|
|
frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
|
|
CFI_INSTRUCTION def_cfa_offset 16
|
|
$rsi = MOV64rr $rsp
|
|
DBG_VALUE $rdi, $noreg, !32, !DIExpression(), debug-location !35
|
|
CALL64pcrel32 @_ZN1CC2E1B, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, debug-location !36
|
|
$rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !36
|
|
CFI_INSTRUCTION def_cfa_offset 8, debug-location !36
|
|
RETQ debug-location !36
|
|
|
|
...
|