xref: /llvm-project/llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir (revision 92b33822e989884d29465d34769b07d78aeb1a84)
1# RUN: llc -mtriple=x86_64-pc-linux %s -dwarf-version=5 -start-after=livedebugvalues -filetype=obj -o %t
2# RUN: llvm-dwarfdump -v %t | FileCheck %s
3#
4# CHECK: DW_AT_location {{.*}} (DW_OP_entry_value
5#
6--- |
7  ; ModuleID = 'test.ll'
8  source_filename = "test.c"
9  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10  target triple = "x86_64-unknown-linux-gnu"
11
12  ; Function Attrs: noinline nounwind uwtable
13  define dso_local void @fn1(ptr %x) local_unnamed_addr !dbg !12 {
14  entry:
15    call void @llvm.dbg.value(metadata ptr %x, metadata !16, metadata !DIExpression()), !dbg !18
16    %0 = ptrtoint ptr %x to i64, !dbg !18
17    %y = trunc i64 %0 to i32, !dbg !18
18    call void @llvm.dbg.value(metadata i32 %y, metadata !17, metadata !DIExpression()), !dbg !18
19    tail call void @fn2(i32 7), !dbg !18
20    ret void, !dbg !18
21  }
22
23  declare !dbg !4 dso_local void @fn2(i32) local_unnamed_addr
24
25  ; Function Attrs: nounwind readnone speculatable
26  declare void @llvm.dbg.value(metadata, metadata, metadata)
27
28  !llvm.dbg.cu = !{!0}
29  !llvm.module.flags = !{!8, !9, !10}
30  !llvm.ident = !{!11}
31
32  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
33  !1 = !DIFile(filename: "test.c", directory: "/dir")
34  !2 = !{}
35  !3 = !{!4}
36  !4 = !DISubprogram(name: "fn2", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
37  !5 = !DISubroutineType(types: !6)
38  !6 = !{null, !7}
39  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
40  !8 = !{i32 2, !"Dwarf Version", i32 5}
41  !9 = !{i32 2, !"Debug Info Version", i32 3}
42  !10 = !{i32 1, !"wchar_size", i32 4}
43  !11 = !{!"clang version 9.0.0"}
44  !12 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 5, type: !13, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
45  !13 = !DISubroutineType(types: !14)
46  !14 = !{null, !7, !7}
47  !15 = !{!16, !17}
48  !16 = !DILocalVariable(name: "x", arg: 1, scope: !12, file: !1, line: 5, type: !7)
49  !17 = !DILocalVariable(name: "y", scope: !12, file: !1, line: 5, type: !7)
50  !18 = !DILocation(line: 0, scope: !12)
51
52...
53---
54name:            fn1
55alignment:       16
56tracksRegLiveness: true
57body:             |
58  bb.0.entry:
59  liveins: $rdi
60    DBG_VALUE $rdi, $noreg, !16, !DIExpression(), debug-location !18
61    DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !18
62    DBG_VALUE $edi, $noreg, !17, !DIExpression(), debug-location !18
63    $edi = KILL renamable $edi, implicit killed $rdi, debug-location !18
64    DBG_VALUE $rdi, $noreg, !16, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !18
65    TAILJMPd64 @fn2, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $edi, debug-location !18
66
67...
68