85 lines · plain
1# RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \2# RUN: | llvm-dwarfdump - -name locala -o - | FileCheck %s3#4# Test that clobbers between DBG_VALUE_LIST and DBG_VALUE instructions work as5# expected. Comments and test directives inline.6 7--- |8 target triple = "x86_64-unknown-linux-gnu"9 define dso_local i32 @fun() local_unnamed_addr !dbg !7 {10 entry:11 ret i32 012 }13 14 !llvm.dbg.cu = !{!0}15 !llvm.module.flags = !{!3, !4, !5}16 !llvm.ident = !{!6}17 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)19 !1 = !DIFile(filename: "example.c", directory: "/")20 !2 = !{}21 !3 = !{i32 7, !"Dwarf Version", i32 4}22 !4 = !{i32 2, !"Debug Info Version", i32 3}23 !5 = !{i32 1, !"wchar_size", i32 4}24 !6 = !{!"clang version 11.0.0"}25 !8 = !DISubroutineType(types: !9)26 !9 = !{!10}27 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)28 !11 = !{!12}29 !22 = !DISubroutineType(types: !23)30 !23 = !{!10, !10}31 ; --- Important metadata ---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)33 !15 = !DILocation(line: 1, column: 1, scope: !7)34 !12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)35 36...37---38name: fun39body: |40 bb.0.entry:41 ; This test checks that we see expected location ranges for a single variable.42 ; CHECK: {{.*}} DW_TAG_variable43 ; CHECK-NEXT: DW_AT_location {{.*}}44 45 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $eax, debug-location !1546 ; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value47 48 $edi = MOV32ri 149 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $esi, debug-location !1550 ; CHECK-NEXT: [{{.*}}): DW_OP_breg4 RSI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value51 52 $eax = MOV32ri 253 DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !1554 ; CHECK-NEXT: [{{.*}}): DW_OP_reg0 RAX55 56 $ecx = MOV32ri 357 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 !1558 ; 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_value59 60 ; Check that a reg clobber prevents identical locations merging.61 $ecx = MOV32ri 462 $ecx = MOV32ri 563 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 !1564 ; 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_value65 66 ; Check that fragments are composed correctly.67 $ecx = MOV32ri 668 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 16), $eax, debug-location !1569 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $ecx, debug-location !1570 ; 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 0x271 72 ; Check that fragments clobber preceeding overlap.73 $edi = MOV32ri 774 DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $edi, debug-location !1575 ; 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 0x276 77 ; Check that a (non-zero-offset) fragment works.78 $ecx = MOV32ri 879 $ecx = MOV32ri 980 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 !1581 ; 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 0x282 83 RET64 debug-location !1584...85