xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll (revision 087172258a50d5bcabe43aff072a20701f0808ef)
1; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - | FileCheck %s
2; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 -o /dev/null
3; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - --try-experimental-debuginfo-iterators | FileCheck %s
4; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 -o /dev/null --try-experimental-debuginfo-iterators
5
6; struct NTCopy {
7;   NTCopy();
8;   NTCopy(const NTCopy &);
9;   int x;
10; };
11; int foo(NTCopy o) {
12;   return o.x;
13; }
14
15; ModuleID = 'ntcopy.cpp'
16source_filename = "ntcopy.cpp"
17target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
18target triple = "aarch64-unknown-linux-gnu"
19
20%struct.NTCopy = type { i32 }
21
22; CHECK-LABEL: name: _Z3foo6NTCopy
23; CHECK: DBG_VALUE %{{[0-9]+}}(p0), 0, !23, !DIExpression(), debug-location !24
24; Function Attrs: noinline nounwind optnone
25define dso_local i32 @_Z3foo6NTCopy(ptr %o) #0 !dbg !7 {
26entry:
27  call void @llvm.dbg.declare(metadata ptr %o, metadata !23, metadata !DIExpression()), !dbg !24
28  %0 = load i32, ptr %o, align 4, !dbg !25
29  ret i32 %0, !dbg !26
30}
31
32; Function Attrs: nounwind readnone speculatable
33declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
34
35attributes #0 = { noinline nounwind optnone }
36attributes #1 = { nounwind readnone speculatable }
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!3, !4, !5}
40!llvm.ident = !{!6}
41
42!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
43!1 = !DIFile(filename: "ntcopy.cpp", directory: "/tmp")
44!2 = !{}
45!3 = !{i32 2, !"Dwarf Version", i32 4}
46!4 = !{i32 2, !"Debug Info Version", i32 3}
47!5 = !{i32 1, !"wchar_size", i32 4}
48!6 = !{!"clang version 8.0.0 "}
49!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foo6NTCopy", scope: !1, file: !1, line: 6, type: !8, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
50!8 = !DISubroutineType(types: !9)
51!9 = !{!10, !11}
52!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NTCopy", file: !1, line: 1, size: 32, flags: DIFlagTypePassByReference, elements: !12, identifier: "_ZTS6NTCopy")
54!12 = !{!13, !14, !18}
55!13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 4, baseType: !10, size: 32)
56!14 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 2, type: !15, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)
57!15 = !DISubroutineType(types: !16)
58!16 = !{null, !17}
59!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
60!18 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 3, type: !19, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false)
61!19 = !DISubroutineType(types: !20)
62!20 = !{null, !17, !21}
63!21 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !22, size: 64)
64!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11)
65!23 = !DILocalVariable(name: "o", arg: 1, scope: !7, file: !1, line: 6, type: !11)
66!24 = !DILocation(line: 6, column: 16, scope: !7)
67!25 = !DILocation(line: 7, column: 12, scope: !7)
68!26 = !DILocation(line: 7, column: 3, scope: !7)
69