1; RUN: opt -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s 2 3;; Also test with RemoveDIs to verify that debug intrinsics immediately 4;; preceding an alloca (or other instruction of interest to stack tagging) will 5;; be correctly processed. 6; RUN: opt --try-experimental-debuginfo-iterators -aarch64-stack-tagging -stack-tagging-record-stack-history=instr -S -o - %s | FileCheck %s 7 8target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 9target triple = "aarch64--linux-android35" 10 11declare void @g(ptr, ptr, ptr, ptr, ptr, ptr) 12 13define void @f() sanitize_memtag !dbg !6 { 14entry: 15 %nodebug0 = alloca ptr 16 %nodebug1 = alloca ptr 17 %nodebug2 = alloca ptr 18 %nodebug3 = alloca ptr 19 %a = alloca ptr 20 ; CHECK: #dbg_declare{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 4) 21 call void @llvm.dbg.declare(metadata ptr %a, metadata !12, metadata !DIExpression()), !dbg !14 22 ; CHECK: #dbg_declare{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 4) 23 call void @llvm.dbg.declare(metadata ptr %a, metadata !12, metadata !DIExpression()), !dbg !14 24 %b = alloca ptr 25 ; CHECK: #dbg_declare{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 5) 26 call void @llvm.dbg.declare(metadata ptr %b, metadata !13, metadata !DIExpression()), !dbg !14 27 ; CHECK: #dbg_declare{{.*}} !DIExpression(DW_OP_LLVM_tag_offset, 5) 28 call void @llvm.dbg.declare(metadata ptr %b, metadata !13, metadata !DIExpression()), !dbg !14 29 call void @g(ptr %nodebug0, ptr %nodebug1, ptr %nodebug2, ptr %nodebug3, ptr %a, ptr %b) 30 ret void, !dbg !15 31} 32 33declare void @llvm.dbg.declare(metadata, metadata, metadata) 34 35!llvm.dbg.cu = !{!0} 36!llvm.module.flags = !{!3, !4} 37!llvm.ident = !{!5} 38 39!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 40!1 = !DIFile(filename: "x.c", directory: "/") 41!2 = !{} 42!3 = !{i32 2, !"Dwarf Version", i32 4} 43!4 = !{i32 2, !"Debug Info Version", i32 3} 44!5 = !{!"clang"} 45!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: 46DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 47!7 = !DISubroutineType(types: !8) 48!8 = !{null, !9} 49!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64) 50!10 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11) 51!11 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 52!12 = !DILocalVariable(name: "a", scope: !6, file: !1, line: 1, type: !9) 53!13 = !DILocalVariable(name: "b", scope: !6, file: !1, line: 1, type: !9) 54!14 = !DILocation(line: 1, column: 29, scope: !6) 55!15 = !DILocation(line: 1, column: 37, scope: !6) 56