brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · e1d3670 Raw
121 lines · plain
1# RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \2# RUN:     | llvm-dwarfdump - -name local* -regex \3# RUN:     | FileCheck %s4#5# Test that the -trim-var-locs option (enabled by default) works correctly.6# Test directives and comments inline.7 8--- |9  target triple = "x86_64-unknown-linux-gnu"10  define dso_local i32 @fun() local_unnamed_addr !dbg !7 {11  entry:12    ret i32 013  }14 15  !llvm.dbg.cu = !{!0}16  !llvm.module.flags = !{!3, !4, !5}17  !llvm.ident = !{!6}18 19  !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)20  !1 = !DIFile(filename: "example.c", directory: "/")21  !2 = !{}22  !3 = !{i32 7, !"Dwarf Version", i32 4}23  !4 = !{i32 2, !"Debug Info Version", i32 3}24  !5 = !{i32 1, !"wchar_size", i32 4}25  !6 = !{!"clang version 11.0.0"}26  !8 = !DISubroutineType(types: !9)27  !9 = !{!10}28  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)29  !11 = !{!12, !13, !25}30  !22 = !DISubroutineType(types: !23)31  !23 = !{!10, !10}32  ; --- Important metadata ---33  !7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)34  !24 = distinct !DILexicalBlock(scope: !7, file: !1, line: 9, column: 3)35  !14 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 3)36  !12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)37  !13 = !DILocalVariable(name: "localb", scope: !14, file: !1, line: 2, type: !10)38  !25 = !DILocalVariable(name: "localc", scope: !24, file: !1, line: 3, type: !10)39  !15 = !DILocation(line: 1, column: 0, scope: !7)40  !18 = !DILocation(line: 2, column: 1, scope: !14)41  !26 = !DILocation(line: 3, column: 1, scope: !24)42...43---44name:            fun45body:             |46  bb.0.entry:47    ; This is the scope and variable structure:48    ; int fun() {       // scope fun !749    ;   int locala;     // scope fun !7,        var locala !12, debug-location !1550    ;   { int localb; } // scope fun:block !14, var localb !13, debug-location !1851    ;   { int localc; } // scope fun:block !24, var localc !25, debug-location !2652    ; }53    ;54    ; (1) Check that a variable location range found in implied scope fun !7 is55    ;     not trimmed.56    ;57    ; CHECK:      DW_TAG_variable58    ; CHECK-NEXT:   DW_AT_location59    ; CHECK-NEXT:     DW_OP_reg0 RAX60    ; CHECK-NEXT:   DW_AT_name ("locala")61    ;62    ; scope fun !7 is implied as we're in function fun and haven't seen a debug-location63    $eax = MOV32ri 064    ; locala range 1 start in implicit scope fun !765    DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !1566    $edi = MOV32ri 167    ; locala range 1 clobber in implicit scope fun !768    $eax = MOV32ri 269    ; scope fun !7 explicit start70    $edi = MOV32ri 3, debug-location !1571 72    ; (2) Check that a variable location range found outside lexical block is73    ;     trimmed. See check directives for (3).74    ;75    ; localb range 1 start in scope fun !7 (outside block !14).76    DBG_VALUE $eax, $noreg, !13, !DIExpression(), debug-location !1877    ; localb range 1 clobber in scope fun !778    $edi = MOV32ri 4, debug-location !1579 80    ; (3) Check that a variable location range which overlaps the entire lexical81    ;     block is not trimmed.82    ;83    ; CHECK:      DW_TAG_variable84    ; CHECK-NEXT:   DW_AT_location (DW_OP_reg5 RDI)85    ; CHECK-NEXT:   DW_AT_name ("localb")86    ;87    ; localb range 2 clobber in scope fun !7 (outside block !14)88    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !1889    ; scope block !14 start (and only instruction)90    $edi = MOV32ri 5, debug-location !1891 92    ; (4) Check that a variable location range in scope fun !7 (outside block93    ;     !14) is trimmed. See check directives for (3).94    ;95    ; localb range 3 starts after scope !14 (prev instr is last in scope)96    DBG_VALUE $rax, $noreg, !13, !DIExpression(), debug-location !1897    ; scope block !14 end98    $edi = MOV32ri 6, debug-location !1599 100    ; (5) Check that a variable location range found between disjoint scope101    ;     ranges is trimmed.102    ;103    ; CHECK:      DW_TAG_variable104    ; CHECK-NOT:    DW_AT_location105    ; CHECK-NEXT:   DW_AT_name ("localc")106    ;107    ; scope fun !7108    $edi = MOV32ri 6, debug-location !15109    ; scope block !24 start and end range 1110    $edi = MOV32ri 7, debug-location !26111    ; localc range 1 start in scope !7112    DBG_VALUE $edi, $noreg, !25, !DIExpression(), debug-location !18113    ; localc range 1 clobber in scope !7114    $edi = MOV32ri 8, debug-location !15115    ; scope block !24 start and end range 2116    $edi = MOV32ri 9, debug-location !26117 118    ; scope fun !7119    RET64 debug-location !15120...121