File: live-debug-values-bad-transfer.mir

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (100 lines) | stat: -rw-r--r-- 3,424 bytes parent folder | download | duplicates (12)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -run-pass=livedebugvalues -experimental-debug-variable-locations=true | FileCheck %s -check-prefix=NEWLDV --implicit-check-not=DBG_VALUE
#
# Test that the DBG_VALUE of ecx below does not get propagated. It is considered
# live-in on LiveDebugValues' first pass through the loop, but on the second it
# should be removed from the InLocs set because it gets clobbered inside the
# loop. There should be no transfer from ecx to ebx -- this is ensured by the
# FileCheck implicit-check-not option.
#
# An identical test in llvm/test/DebugInfo/MIR/X86/live-debug-values-bad-transfer2.mir
# checks this for VarLocBasedLDV.
#
# NEWLDV-LABEL: name: foo
# NEWLDV-LABEL: bb.0.entry:
# NEWLDV:       $ecx = MOV32ri 0
# NEWLDV-NEXT:  DBG_VALUE

--- |
  source_filename = "live-debug-values-remove-range.ll"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  
  declare void @llvm.dbg.value(metadata, metadata, metadata)
  
  define i32 @foo(i32 %bar) !dbg !4 {
  entry:
    br label %loop
  loop:
    br label %loop
  exit:
    ret i32 %bar
  }
  
  !llvm.module.flags = !{!0, !1}
  !llvm.dbg.cu = !{!2}
  
  !0 = !{i32 2, !"Debug Info Version", i32 3}
  !1 = !{i32 2, !"Dwarf Version", i32 4}
  !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "beards", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
  !3 = !DIFile(filename: "bees.cpp", directory: ".")
  !4 = distinct !DISubprogram(name: "nope", scope: !3, file: !3, line: 1, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
  !5 = !DISubroutineType(types: !6)
  !6 = !{!7}
  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  !8 = !{!9}
  !9 = !DILocalVariable(name: "thin", scope: !4, file: !3, line: 1, type: !7)
  !10 = !DILocation(line: 1, scope: !4)

...
---
name:            foo
alignment:       4
tracksRegLiveness: true
debugInstrRef: true
liveins:
  - { reg: '$edi' }
frameInfo:
  stackSize:       8
  offsetAdjustment: -8
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
  cvBytesOfCalleeSavedRegisters: 8
fixedStack:
  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' }
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    liveins: $edi, $rbx
  
    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 16
    CFI_INSTRUCTION offset $rbx, -16
    $ebx = MOV32rr $edi
    $eax = MOV32ri 0, debug-location !10
    $ecx = MOV32ri 0, debug-location !10
    DBG_VALUE $ecx, $noreg, !9, !DIExpression(), debug-location !10
    $edi = MOV32ri 0, debug-location !10
    $esi = MOV32ri 0, debug-location !10
  
  bb.1.loop:
    successors: %bb.1, %bb.2
    liveins: $ebx, $eax, $ecx, $edi, $esi
  
    $eax = COPY $ecx, debug-location !10
    $ebx = COPY killed $ecx, debug-location !10
    $ecx = COPY killed $edi, debug-location !10
    $edi = COPY killed $esi, debug-location !10
    $esi = MOV32ri 1, debug-location !10
    TEST8ri killed renamable $al, 1, implicit-def $eflags
    JCC_1 %bb.1, 5, implicit killed $eflags, debug-location !10
  
  bb.2.exit:
    liveins: $ebx
  
    $eax = MOV32rr killed $ebx, debug-location !10
    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 8
    RET64 $eax, debug-location !10

...