1 ; RUN: %llc_dwarf -stop-after=livedebugvalues -o - %s \ 2 ; RUN: | FileCheck %s --check-prefix=SANITY 3 ; RUN: %llc_dwarf -march=x86-64 -o - %s -filetype=obj \ 4 ; RUN: | llvm-dwarfdump -debug-dump=all - | FileCheck %s 5 ; 6 ; CHECK: .debug_info contents: 7 ; CHECK: DW_TAG_variable 8 ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] 9 ; CHECK-NEXT: DW_AT_name{{.*}}"a" 10 ; CHECK: .debug_loc contents: 11 ; rax, piece 0x00000004 12 ; CHECK: Location description: 50 93 04 13 ; SANITY: DBG_VALUE 14 ; SANITY-NOT: DBG_VALUE 15 ; ModuleID = 'test.ll' 16 ; Compiled with -O: 17 ; void h(int); 18 ; int g(); 19 ; void f() { 20 ; h(0); 21 ; int a = g(); 22 ; h(a); 23 ; } 24 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 25 target triple = "x86_64-apple-macosx" 26 27 ; Function Attrs: nounwind ssp uwtable 28 define void @f() #0 !dbg !4 { 29 entry: 30 tail call void @h(i32 0) #2, !dbg !14 31 %call = tail call i32 (...) @g() #2, !dbg !15 32 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !8, metadata !16), !dbg !17 33 tail call void @h(i32 %call) #2, !dbg !18 34 ret void, !dbg !19 35 } 36 37 declare void @h(i32) 38 39 declare i32 @g(...) 40 41 ; Function Attrs: nounwind readnone 42 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 43 44 attributes #0 = { nounwind ssp uwtable "no-frame-pointer-elim"="true" } 45 attributes #1 = { nounwind readnone } 46 attributes #2 = { nounwind } 47 48 !llvm.dbg.cu = !{!0} 49 !llvm.module.flags = !{!10, !11, !12} 50 !llvm.ident = !{!13} 51 52 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 53 !1 = !DIFile(filename: "test.c", directory: "/Volumes/Data/llvm") 54 !2 = !{} 55 !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !7) 56 !5 = !DISubroutineType(types: !6) 57 !6 = !{null} 58 !7 = !{!8} 59 !8 = !DILocalVariable(name: "a", scope: !4, file: !1, line: 5, type: !9) 60 !9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 61 !10 = !{i32 2, !"Dwarf Version", i32 2} 62 !11 = !{i32 2, !"Debug Info Version", i32 3} 63 !12 = !{i32 1, !"PIC Level", i32 2} 64 !13 = !{!"clang version 3.9.0 "} 65 !14 = !DILocation(line: 4, column: 3, scope: !4) 66 !15 = !DILocation(line: 5, column: 11, scope: !4) 67 !16 = !DIExpression() 68 !17 = !DILocation(line: 5, column: 7, scope: !4) 69 !18 = !DILocation(line: 6, column: 3, scope: !4) 70 !19 = !DILocation(line: 7, column: 1, scope: !4) 71