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