1; RUN: llc -mtriple=x86_64-unknown-unknown -o - %s | FileCheck %s 2; RUN: llc -mtriple=x86_64-unknown-unknown -filetype=obj < %s \ 3; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=DWARF 4 5define i1 @test() !dbg !4 { 6entry: 7 %end = alloca i64, align 8 8 br label %while.cond 9 10while.cond: 11 call void @llvm.dbg.value(metadata i64* %end, metadata !5, metadata !6), !dbg !7 12 %call = call i1 @fn(i64* %end, i64* %end, i64* null, i8* null, i64 0, i64* null, i32* null, i8* null), !dbg !7 13 br label %while.body 14 15while.body: 16 br i1 0, label %while.end, label %while.cond 17 18while.end: 19 ret i1 true 20} 21 22; CHECK-LABEL: test 23; To get the value of the variable, we need to do [$rsp+8], i.e: 24; CHECK: #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8, DW_OP_deref] $rsp 25; DWARF: DW_AT_location [DW_FORM_sec_offset] ( 26; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+8) 27 28; Note: A previous version of this test checked for `[DW_OP_plus_uconst 8] [$rsp+0]`, 29; which is incorrect, because it adds the stack offset after dereferencing the stack pointer. 30 31declare i1 @fn(i64*, i64*, i64*, i8*, i64, i64*, i32*, i8*) 32declare void @llvm.dbg.value(metadata, metadata, metadata) 33 34!llvm.dbg.cu = !{!0} 35!llvm.module.flags = !{!2,!3} 36 37!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0", emissionKind: FullDebug) 38!1 = !DIFile(filename: "test.c", directory: "/") 39!2 = !{i32 2, !"Dwarf Version", i32 4} 40!3 = !{i32 2, !"Debug Info Version", i32 3} 41!4 = distinct !DISubprogram(name: "test", type: !10, unit: !0) 42!5 = !DILocalVariable(name: "w", scope: !4, type: !9) 43!6 = !DIExpression(DW_OP_deref) 44!7 = !DILocation(line: 210, column: 12, scope: !4) 45!8 = !{!9} 46!9 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) 47!10 = !DISubroutineType(types: !8) 48