xref: /llvm-project/llvm/test/CodeGen/AArch64/dbg-assign-tag-offset.ll (revision d860ea96b1d4bcc13bf269e9b108d8f5e0c21d93)
1; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
2; RUN: llc --try-experimental-debuginfo-iterators -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
3
4;; Copied from dbg-value-tag-offset.ll. Check that variables with locations
5;; tracked with dbg.assigns with DW_OP_LLVM_TAG_offset operators in their
6;; expressions get a DW_AT_LLVM_tag_offset attribute on their DIE.
7
8target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
9target triple = "aarch64-unknown-linux-android24"
10
11; CHECK:      DW_TAG_variable
12; CHECK-NOT:  DW_TAG
13; CHECK:        DW_AT_LLVM_tag_offset (0x00)
14; CHECK-NEXT:   DW_AT_name    ("x")
15
16; CHECK:      DW_TAG_variable
17; CHECK-NOT:  DW_TAG
18; CHECK:        DW_AT_LLVM_tag_offset (0x80)
19; CHECK-NEXT:   DW_AT_name    ("y")
20
21define dso_local void @f() !dbg !14 {
22  %1 = alloca i32, align 4, !DIAssignID !31
23  call void @llvm.dbg.assign(metadata i1 undef, metadata !18, metadata !DIExpression(), metadata !31, metadata ptr %1, metadata !DIExpression(DW_OP_LLVM_tag_offset, 0)), !dbg !22
24  %2 = alloca i32, align 4, !DIAssignID !32
25  call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !32, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22
26  store i32 1, ptr %2, align 4, !dbg !23, !tbaa !24, !DIAssignID !33
27  call void @llvm.dbg.assign(metadata i32 1, metadata !20, metadata !DIExpression(), metadata !33, metadata ptr %2, metadata !DIExpression(DW_OP_LLVM_tag_offset, 128)), !dbg !22
28  call void @use(ptr nonnull %1), !dbg !28
29  call void @use(ptr nonnull %2), !dbg !29
30  ret void, !dbg !30
31}
32
33declare !dbg !5 void @use(ptr)
34
35declare void @llvm.dbg.value(metadata, metadata, metadata)
36declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!8, !9, !10, !11, !12, !34}
40!llvm.ident = !{!13}
41
42!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, retainedTypes: !3, nameTableKind: None)
43!1 = !DIFile(filename: "dbg.cc", directory: "/tmp")
44!2 = !{}
45!3 = !{!4, !5}
46!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
47!5 = !DISubprogram(name: "use", scope: !1, file: !1, line: 2, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
48!6 = !DISubroutineType(types: !7)
49!7 = !{null, !4}
50!8 = !{i32 7, !"Dwarf Version", i32 4}
51!9 = !{i32 2, !"Debug Info Version", i32 3}
52!10 = !{i32 1, !"wchar_size", i32 4}
53!11 = !{i32 7, !"PIC Level", i32 2}
54!12 = !{i32 7, !"PIE Level", i32 2}
55!13 = !{!"clang version 10.0.0"}
56!14 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !15, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
57!15 = !DISubroutineType(types: !16)
58!16 = !{null}
59!17 = !{!18, !20}
60!18 = !DILocalVariable(name: "x", scope: !14, file: !1, line: 5, type: !19)
61!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
62!20 = !DILocalVariable(name: "y", scope: !14, file: !1, line: 5, type: !19)
63!21 = !DILocation(line: 5, column: 3, scope: !14)
64!22 = !DILocation(line: 0, scope: !14)
65!23 = !DILocation(line: 5, column: 10, scope: !14)
66!24 = !{!25, !25, i64 0}
67!25 = !{!"int", !26, i64 0}
68!26 = !{!"omnipotent char", !27, i64 0}
69!27 = !{!"Simple C++ TBAA"}
70!28 = !DILocation(line: 6, column: 3, scope: !14)
71!29 = !DILocation(line: 7, column: 3, scope: !14)
72!30 = !DILocation(line: 8, column: 1, scope: !14)
73!31 = distinct !DIAssignID()
74!32 = distinct !DIAssignID()
75!33 = distinct !DIAssignID()
76!34 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
77