xref: /llvm-project/llvm/test/CodeGen/AArch64/stack-tagging-dbg-assign-tag-offset.ll (revision 60af1548e138ecd8b899f23bdf91ee294d777239)
1; RUN: opt -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s
2; RUN: opt --try-experimental-debuginfo-iterators  -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s
3
4source_filename = "test.ll"
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6target triple = "aarch64--linux-android35"
7
8declare void @g(ptr, ptr, ptr, ptr, ptr, ptr)
9
10; Function Attrs: sanitize_memtag
11define void @f() #0 !dbg !7 {
12entry:
13  %nodebug0 = alloca ptr, align 8
14  %nodebug1 = alloca ptr, align 8
15  %nodebug2 = alloca ptr, align 8
16  %nodebug3 = alloca ptr, align 8
17  ; CHECK: %a = alloca{{.*}} !DIAssignID ![[ID1:[0-9]+]]
18  %a = alloca ptr, align 8, !DIAssignID !13
19  ; CHECK: #dbg_assign{{.*}} ![[ID1]]{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 4)
20  call void @llvm.dbg.assign(metadata i1 undef, metadata !14, metadata !DIExpression(), metadata !13, metadata ptr %a, metadata !DIExpression()), !dbg !15
21  ; CHECK: %b = alloca{{.*}} !DIAssignID ![[ID2:[0-9]+]]
22  %b = alloca ptr, align 8, !DIAssignID !16
23  ; CHECK: #dbg_assign{{.*}} ![[ID2]]{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 5)
24  call void @llvm.dbg.assign(metadata i1 undef, metadata !17, metadata !DIExpression(), metadata !16, metadata ptr %b, metadata !DIExpression()), !dbg !15
25  call void @g(ptr %nodebug0, ptr %nodebug1, ptr %nodebug2, ptr %nodebug3, ptr %a, ptr %b)
26  ret void, !dbg !18
27}
28
29; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
30declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
31
32; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
33declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1
34
35attributes #0 = { sanitize_memtag }
36attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
43!1 = !DIFile(filename: "x.c", directory: "/")
44!2 = !{}
45!3 = !{i32 2, !"Dwarf Version", i32 4}
46!4 = !{i32 2, !"Debug Info Version", i32 3}
47!5 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
48!6 = !{!"clang"}
49!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
50!8 = !DISubroutineType(types: !9)
51!9 = !{null, !10}
52!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
53!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12)
54!12 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
55!13 = distinct !DIAssignID()
56!14 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 1, type: !10)
57!15 = !DILocation(line: 0, scope: !7)
58!16 = distinct !DIAssignID()
59!17 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 1, type: !10)
60!18 = !DILocation(line: 1, column: 37, scope: !7)
61