1 # RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \
\r
2 # RUN: | llvm-dwarfdump - -name locala -o - | FileCheck %s
\r
4 # Test that clobbers between DBG_VALUE_LIST and DBG_VALUE instructions work as
\r
5 # expected. Comments and test directives inline.
\r
8 target triple = "x86_64-unknown-linux-gnu"
\r
9 define dso_local i32 @fun() local_unnamed_addr !dbg !7 {
\r
14 !llvm.dbg.cu = !{!0}
\r
15 !llvm.module.flags = !{!3, !4, !5}
\r
18 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
\r
19 !1 = !DIFile(filename: "example.c", directory: "/")
\r
21 !3 = !{i32 7, !"Dwarf Version", i32 4}
\r
22 !4 = !{i32 2, !"Debug Info Version", i32 3}
\r
23 !5 = !{i32 1, !"wchar_size", i32 4}
\r
24 !6 = !{!"clang version 11.0.0"}
\r
25 !8 = !DISubroutineType(types: !9)
\r
27 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
\r
29 !22 = !DISubroutineType(types: !23)
\r
31 ; --- Important metadata ---
\r
32 !7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
\r
33 !15 = !DILocation(line: 1, column: 1, scope: !7)
\r
34 !12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)
\r
41 ; This test checks that we see expected location ranges for a single variable.
\r
42 ; CHECK: {{.*}} DW_TAG_variable
\r
43 ; CHECK-NEXT: DW_AT_location {{.*}}
\r
45 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $eax, debug-location !15
\r
46 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
\r
49 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $esi, debug-location !15
\r
50 ; CHECK-NEXT: [{{.*}}): DW_OP_breg4 RSI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
\r
53 DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
\r
54 ; CHECK-NEXT: [{{.*}}): DW_OP_reg0 RAX
\r
57 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
\r
58 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
\r
60 ; Check that a reg clobber prevents identical locations merging.
\r
63 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
\r
64 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
\r
66 ; Check that fragments are composed correctly.
\r
68 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 16), $eax, debug-location !15
\r
69 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $ecx, debug-location !15
\r
70 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
\r
72 ; Check that fragments clobber preceeding overlap.
\r
74 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $edi, debug-location !15
\r
75 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg5 RDI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
\r
77 ; Check that a (non-zero-offset) fragment works.
\r
80 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $eax, $ecx, debug-location !15
\r
81 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x2
\r
83 RET64 debug-location !15
\r