File: live-debug-vars-index.mir

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (53 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# After adding new debug instruction for labels, it is possible to have
# debug instructions before DBG_VALUE. When querying DBG_VALUE's slot
# index using previous instruction and the previous instruction is debug
# instruction, it will trigger an assertion as using debug instruction
# to get slot index. This test is to emulate the case when DBG_VALUE's
# previous instruction is DBG_LABEL in LiveDebugVariables pass.
#
# RUN: llc -run-pass=livedebugvars -run-pass=virtregrewriter -o - %s | FileCheck %s

--- |
  target triple = "x86_64-unknown-linux-gnu"

  define i32 @foo(i32 %a, i32 %b) !dbg !4 {
  entry:
    ret i32 0, !dbg !12
  }

  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3}

  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
  !1 = !DIFile(filename: "debug-var-slot.c", directory: "./")
  !2 = !{}
  !3 = !{i32 2, !"Debug Info Version", i32 3}
  !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !2)
  !5 = !DISubroutineType(types: !6)
  !6 = !{!7, !7, !7}
  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !8 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
  !9 = !DILocation(line: 4, column: 1, scope: !4)
  !10 = !DILocalVariable(name: "local_var", scope: !4, file: !1, line: 7, type: !7)
  !11 = !DILocation(line: 7, column: 1, scope: !4)
  !12 = !DILocation(line: 8, column: 3, scope: !4)
  !13 = !DILocalVariable(name: "local_var2", scope: !4, file: !1, line: 7, type: !7)

...
---
name:            foo
tracksRegLiveness: true
body:             |
  bb.0:

    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !11
    DBG_LABEL !8, debug-location !9
    DBG_VALUE $edi, $noreg, !10, !DIExpression(), debug-location !11
    RET 0, undef $eax, debug-location !12
...

# CHECK-LABEL: name:            foo
# CHECK: bb.0:
# CHECK-DAG: DBG_LABEL
# CHECK-DAG: DBG_VALUE $esi
# CHECK-DAG: DBG_VALUE $edi