1# RUN: llc -start-after=livedebugvalues --filetype=obj %s -o - \ 2# RUN: | llvm-dwarfdump -v - | FileCheck %s 3# 4# Generated at -O2, stopped after livedebugvalues, with some metadata removed 5# by hand: 6# int global; 7# void ext(); 8# void fun(int p) { 9# { 10# int local = p; 11# global = local; 12# } 13# ext(); 14# } 15# 16# The variable 'local' is available for the entirety of its enclosing scope so 17# we expect to see a single location entry. 18# 19# Except for 'local', all DILocalVariable metadata has been removed. 20# 21# CHECK: DW_TAG_lexical_block [ 22# CHECK: DW_TAG_variable 23# CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_reg5 RDI) 24# CHECK-NEXT: DW_AT_name {{.*}} = "local" 25 26--- | 27 target triple = "x86_64-unknown-linux-gnu" 28 @global = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0 29 define dso_local void @fun(i32 %p) local_unnamed_addr !dbg !15 { 30 entry: 31 call void @llvm.dbg.value(metadata i32 %p, metadata !20, metadata !DIExpression()), !dbg !23 32 store i32 %p, i32* @global, align 4, !dbg !24 33 tail call void (...) @ext(), !dbg !29 34 ret void, !dbg !30 35 } 36 37 declare !dbg !6 dso_local void @ext(...) local_unnamed_addr 38 declare void @llvm.dbg.value(metadata, metadata, metadata) 39 40 !llvm.dbg.cu = !{!2} 41 !llvm.module.flags = !{!11, !12, !13} 42 !llvm.ident = !{!14} 43 44 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 45 !1 = distinct !DIGlobalVariable(name: "global", scope: !2, file: !3, line: 1, type: !10, isLocal: false, isDefinition: true) 46 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !9, splitDebugInlining: false, nameTableKind: None) 47 !3 = !DIFile(filename: "test.c", directory: "/") 48 !4 = !{} 49 !5 = !{!6} 50 !6 = !DISubprogram(name: "ext", scope: !3, file: !3, line: 2, type: !7, spFlags: DISPFlagOptimized, retainedNodes: !4) 51 !7 = !DISubroutineType(types: !8) 52 !8 = !{null, null} 53 !9 = !{!0} 54 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 55 !11 = !{i32 7, !"Dwarf Version", i32 4} 56 !12 = !{i32 2, !"Debug Info Version", i32 3} 57 !13 = !{i32 1, !"wchar_size", i32 4} 58 !14 = !{!"clang version 11.0.0"} 59 !15 = distinct !DISubprogram(name: "fun", scope: !3, file: !3, line: 3, type: !16, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !18) 60 !16 = !DISubroutineType(types: !17) 61 !17 = !{null, !10} 62 !18 = !{!20} 63 !20 = !DILocalVariable(name: "local", scope: !21, file: !3, line: 5, type: !10) 64 !21 = distinct !DILexicalBlock(scope: !15, file: !3, line: 4, column: 3) 65 !22 = !DILocation(line: 0, scope: !15) 66 !23 = !DILocation(line: 0, scope: !21) 67 !24 = !DILocation(line: 6, column: 12, scope: !21) 68 !29 = !DILocation(line: 8, column: 3, scope: !15) 69 !30 = !DILocation(line: 9, column: 1, scope: !15) 70 71... 72--- 73name: fun 74body: | 75 bb.0.entry: 76 liveins: $edi 77 78 DBG_VALUE $edi, $noreg, !20, !DIExpression(), debug-location !23 79 MOV32mr $rip, 1, $noreg, @global, $noreg, killed renamable $edi, debug-location !24 :: (store 4 into @global) 80 dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al, debug-location !29 81 TAILJMPd64 @ext, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $al, debug-location !29 82... 83