File: machinesink-subreg.mir

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (89 lines) | stat: -rw-r--r-- 3,137 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-sink -o - %s | FileCheck %s

# Based on machinesink.mir. Verify that the sub-register index in the DBG_VALUE
# instruction is cleared when marking the debug value undef.

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

  @x = common local_unnamed_addr global i32 0, align 4

  define void @test(i32* nocapture readonly %p) local_unnamed_addr !dbg !14 {
  ; Stripped
  entry:
    br label %block1
  block1:
    br label %exit
  exit:
    ret void
  }

  !llvm.dbg.cu = !{!1}
  !llvm.module.flags = !{!5, !6}
  !llvm.ident = !{!7}

  !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !3)
  !2 = !DIFile(filename: "t.c", directory: "")
  !3 = !{}
  !4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !5 = !{i32 2, !"Dwarf Version", i32 4}
  !6 = !{i32 2, !"Debug Info Version", i32 3}
  !7 = !{!"clang version 4.0.0 "}
  !8 = !DISubroutineType(types: !9)
  !9 = !{null, !10}
  !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
  !11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12)
  !12 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
  !13 = !DIExpression()
  !14 = distinct !DISubprogram(name: "test", scope: !2, file: !2, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !1, retainedNodes: !15)
  !15 = !{!16}
  !16 = !DILocalVariable(name: "var", scope: !14, file: !2, line: 2, type: !12)
  !17 = !DILocation(line: 1, column: 1, scope: !14)

  ; CHECK: [[VAR:![0-9]+]] = !DILocalVariable(name: "var",

...
---
name:            test
tracksRegLiveness: true
liveins:
  - { reg: '$rdi', virtual-reg: '%2' }
  - { reg: '$rsi', virtual-reg: '%2' }
body:             |
  bb.0.entry:
    successors: %bb.1.block1, %bb.2.exit
    liveins: $rdi, $esi

    ; This block should _not_ have the first DBG_VALUE sunk out from it, as it
    ; would pass a later DBG_VALUE of the same variable location. An undef
    ; DBG_VALUE should be left behind though. Verify that the sub-register
    ; index in the DBG_VALUE is cleared.
    ; CHECK-LABEL: bb.0.entry:
    ; CHECK:       [[TEST2VREG:%[0-9]+]]:gr64 = COPY $rdi
    ; CHECK-NEXT:  CMP32ri $esi, 0
    ; CHECK-NEXT:  DBG_VALUE $noreg, $noreg, [[VAR]]
    ; CHECK-NEXT:  CMP32ri $esi, 0
    ; CHECK-NEXT:  DBG_VALUE 0, $noreg, [[VAR]]
    ; CHECK-NEXT:  JCC_1 %bb.1, 4
    ; CHECK-NEXT:  JMP_1

    %2:gr64 = COPY $rdi
    %5:gr64 = ADD64ri8 %2, 1, implicit-def dead $eflags
    CMP32ri $esi, 0, implicit-def $eflags
    DBG_VALUE %5.sub_32bit, $noreg, !16, !13, debug-location !17
    CMP32ri $esi, 0, implicit-def $eflags
    DBG_VALUE 0, $noreg, !16, !13, debug-location !17
    JCC_1 %bb.1.block1, 4, implicit $eflags
    JMP_1 %bb.2.exit

  bb.1.block1:
    successors: %bb.2.exit

    %1:gr64 = ADD64ri8 %5, 4, implicit-def dead $eflags
    JMP_1 %bb.2.exit

  bb.2.exit:
    $rax = MOV64rr %2
    RET 0
...