File: dbg-phi-subregister-location.mir

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (72 lines) | stat: -rw-r--r-- 2,766 bytes parent folder | download | duplicates (9)
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
# RUN: llc %s -run-pass=livedebugvalues -experimental-debug-variable-locations\
# RUN:   -o - | FileCheck %s
#
# In the MIR below, there's an argument in the lowest byte of $edi. The debug
# intrinsics correctly identify the value and where it becomes the variables
# value, however a bug in InstrRefBasedLDV meant that not all subregisters of
# DBG_PHI operands are tracked. That leads to the wrong DBG_VALUE location
# being produced, and a crash under asan.
#
# CHECK-LABEL: name: foo
# CHECK:       DBG_PHI $edi
# CHECK-NEXT:  DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0)
# CHECK-NEXT:  DBG_VALUE_LIST {{.+}} $dil
--- |
  ; ModuleID = 'out.ll'
  source_filename = "out.ll"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-scei-ps4"

  @someglobal = external local_unnamed_addr global i8, align 1

  define hidden void @foo(i1 zeroext %bar) !dbg !7 {
  entry:
    ret void, !dbg !13
  }

  declare void @llvm.dbg.value(metadata, metadata, metadata)

  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5}
  !llvm.ident = !{!6}

  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
  !1 = !DIFile(filename: "test.c", directory: "/tmp/out.c")
  !2 = !{}
  !3 = !{i32 7, !"Dwarf Version", i32 4}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = !{i32 1, !"wchar_size", i32 4}
  !6 = !{!""}
  !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
  !8 = !DISubroutineType(types: !9)
  !9 = !{!10, !11, !11}
  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
  !12 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
  !13 = !DILocation(line: 0, scope: !7)

...
---
name:            foo
alignment:       16
tracksRegLiveness: true
debugInstrRef: true
liveins:
  - { reg: '$edi' }
frameInfo:
  maxAlignment:    1
  maxCallFrameSize: 0
debugValueSubstitutions:
  - { srcinst: 2, srcop: 0, dstinst: 1, dstop: 0, subreg: 1 }
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    liveins: $edi

    DBG_PHI $edi, 1
    DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !13
    renamable $rax = MOV64rm $rip, 1, $noreg, target-flags(x86-gotpcrel) @someglobal, $noreg, debug-location !13 :: (load (s64) from got)
    MOV8mr killed renamable $rax, 1, $noreg, 0, $noreg, renamable $dil, debug-location !13 :: (store (s8) into @someglobal)
    RET64 debug-location !13

...