File: dbg-value-superreg-copy.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 (67 lines) | stat: -rw-r--r-- 2,353 bytes parent folder | download | duplicates (6)
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
# RUN: llc -O1 -start-after simple-register-coalescing -o - %s -experimental-debug-variable-locations=false | FileCheck %s

--- |
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-pc-linux-gnu"

  define i16 @foo(i8 %zzz) !dbg !4 {
  entry:
    ret i16 1
  }

  ; Function Attrs: nounwind readnone speculatable
  declare void @llvm.dbg.value(metadata, metadata, metadata)

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

  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
  !1 = !DIFile(filename: "test.c", directory: "")
  !2 = !{}
  !3 = !{i32 1, !"Debug Info Version", i32 3}
  !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0)
  !5 = !DISubroutineType(types: !6)
  !6 = !{null}
  !7 = !DILocalVariable(name: "zzz", arg: 1, scope: !4, file: !1, line: 3, type: !8)
  !8 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed)
  !9 = !DILocation(line: 0, scope: !4)
  !10 = !DILocation(line: 4, column: 22, scope: !11)
  !11 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3, column: 19)

...
---
name:            foo
tracksRegLiveness: true
body:             |
  bb.0:
    %0:gr16_abcd = MOV16ri 1

  bb.1:
    DBG_VALUE %0.sub_8bit_hi, $noreg, !7, !DIExpression(), debug-location !9
    %1:gr16 = COPY %0
    %2:gr16 = COPY %0

  bb.2:
    $ax = COPY %1
    $dx = COPY %2
    RET64 killed $ax, killed $dx
...

# This test case was created as a reproducer for a bug when we got incorrect
# DBG_VALUE instructions after regalloc like this:
#
#        movw    $1, %cx
#        #DEBUG_VALUE: foo:zzz <- $ch
#        movl    %ecx, %eax
#        #DEBUG_VALUE: foo:zzz <- $ax
#
# The above is incorrect since the DBG_VALUE in the input is refering to the
# hi subreg, so after the COPY/movl the value is in $ah and not $ax (nor $al).
#
# We currently only get one DEBUG_VALUE here. In the future we could allow a
# second DEBUG_VALUE, as long as it is mapped to the hi subreg of the movl
# dst.
#
# CHECK-NOT:    #DEBUG_VALUE:
# CHECK:        #DEBUG_VALUE: foo:zzz <- ${{[abcd]+}}h
# CHECK-NOT:    #DEBUG_VALUE: