320 changes: 160 additions & 160 deletions llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-join.mir
Original file line number Diff line number Diff line change
@@ -1,160 +1,160 @@
# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# Test a series of joins, where:
# * The locations agree, although registers have changed,
# * A register down one of the predecessors has been def'd,
# * The register operands to DBG_VALUE_LIST have been swapped,
# * A spurious additional operand has been added to one path,
# * The expressions are not the same (plus -> minus).
#
# Each join block below checks for one DBG_VALUE_LIST: either we re-state the var
# location in a block for the next test, or it's created as a live-in and we
# use that for the next test. Two DBG_VALUE_LISTs in a block would represent
# a live-in that we didn't expect, and a test failure.
#
# Each conditional block should have at least one, possibly two.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.1:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.2:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi
# CHECK-LABEL: bb.3:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.4:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rdi, $rsi
# CHECK-LABEL: bb.5:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rsi, $rdi
# CHECK-LABEL: bb.6:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.7:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rdi, $rsi, $rax
# CHECK-LABEL: bb.8:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.9:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: DW_OP_minus
# CHECK-LABEL: bb.10:
--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}
; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
body: |
bb.0.entry:
liveins: $rdi, $rsi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.2, 4, implicit $eflags
bb.1:
liveins: $rdi, $rsi
$rdi = MOV64ri 0
$rsi = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
bb.2:
liveins: $rdi, $rsi
; Should be a live-in loc here,
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.4, 4, implicit $eflags
bb.3:
liveins: $rdi, $rsi
$rsi = MOV64ri 0
bb.4:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.6, 4, implicit $eflags
bb.5:
liveins: $rdi, $rsi
; Flip some args,
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rsi, $rdi, debug-location !15
bb.6:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
$rax = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.8, 4, implicit $eflags
bb.7:
liveins: $rdi, $rsi
; Add an extra, spurious, unused argument
$rax = MOV64ri 1
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, $rax, debug-location !15
bb.8:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
$rax = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.10, 4, implicit $eflags
bb.9:
liveins: $rdi, $rsi
; Replace add with sub in the expr
$rax = MOV64ri 1
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus), $rdi, $rsi, debug-location !15
bb.10:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
RET64
...

# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# Test a series of joins, where:
# * The locations agree, although registers have changed,
# * A register down one of the predecessors has been def'd,
# * The register operands to DBG_VALUE_LIST have been swapped,
# * A spurious additional operand has been added to one path,
# * The expressions are not the same (plus -> minus).
#
# Each join block below checks for one DBG_VALUE_LIST: either we re-state the var
# location in a block for the next test, or it's created as a live-in and we
# use that for the next test. Two DBG_VALUE_LISTs in a block would represent
# a live-in that we didn't expect, and a test failure.
#
# Each conditional block should have at least one, possibly two.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.1:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.2:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi
# CHECK-LABEL: bb.3:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.4:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rdi, $rsi
# CHECK-LABEL: bb.5:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rsi, $rdi
# CHECK-LABEL: bb.6:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.7:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: $rdi, $rsi, $rax
# CHECK-LABEL: bb.8:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-LABEL: bb.9:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: DW_OP_minus
# CHECK-LABEL: bb.10:
--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"

; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}

; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
body: |
bb.0.entry:
liveins: $rdi, $rsi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.2, 4, implicit $eflags
bb.1:
liveins: $rdi, $rsi
$rdi = MOV64ri 0
$rsi = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
bb.2:
liveins: $rdi, $rsi
; Should be a live-in loc here,
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.4, 4, implicit $eflags
bb.3:
liveins: $rdi, $rsi
$rsi = MOV64ri 0
bb.4:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.6, 4, implicit $eflags
bb.5:
liveins: $rdi, $rsi
; Flip some args,
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rsi, $rdi, debug-location !15
bb.6:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
$rax = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.8, 4, implicit $eflags
bb.7:
liveins: $rdi, $rsi
; Add an extra, spurious, unused argument
$rax = MOV64ri 1
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, $rax, debug-location !15
bb.8:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
$rax = MOV64ri 0
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
CMP64ri8 $rdi, 0, implicit-def $eflags
JCC_1 %bb.10, 4, implicit $eflags
bb.9:
liveins: $rdi, $rsi
; Replace add with sub in the expr
$rax = MOV64ri 1
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus), $rdi, $rsi, debug-location !15
bb.10:
liveins: $rdi, $rsi
; Should _not_ be a live-in loc here.
RET64
...

180 changes: 90 additions & 90 deletions llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-movements.mir
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# The MIR below moves values from argument registers to callee saved registers,
# moves that are followed by DBG_VALUEs and which should also result in
# DBG_VALUE_LISTs moving their operands.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi
# CHECK: $rbx = COPY killed $rdi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK-LABEL: bb.1:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK: $rbp = COPY killed $rsi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rbp
# CHECK-LABEL: bb.2:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rbp
--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}
; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
fixedStack:
- { id: 0, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbx', callee-saved-restored: true }
- { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbp', callee-saved-restored: true }
body: |
bb.0.entry:
liveins: $rdi, $rsi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
$rbx = COPY killed $rdi
$rdi = MOV64ri 0
JMP_1 %bb.1
bb.1:
liveins: $rbx, $rsi
$rbp = COPY killed $rsi
$rsi = MOV64ri 0
JMP_1 %bb.2
bb.2:
liveins: $rbx, $rbp
RET64 $rbp, debug-location !17
...

# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# The MIR below moves values from argument registers to callee saved registers,
# moves that are followed by DBG_VALUEs and which should also result in
# DBG_VALUE_LISTs moving their operands.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi
# CHECK: $rbx = COPY killed $rdi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK-LABEL: bb.1:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK: $rbp = COPY killed $rsi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rbp
# CHECK-LABEL: bb.2:
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rbp
--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"

; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}

; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
fixedStack:
- { id: 0, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbx', callee-saved-restored: true }
- { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbp', callee-saved-restored: true }
body: |
bb.0.entry:
liveins: $rdi, $rsi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
$rbx = COPY killed $rdi
$rdi = MOV64ri 0
JMP_1 %bb.1
bb.1:
liveins: $rbx, $rsi
$rbp = COPY killed $rsi
$rsi = MOV64ri 0
JMP_1 %bb.2
bb.2:
liveins: $rbx, $rbp
RET64 $rbp, debug-location !17
...

154 changes: 77 additions & 77 deletions llvm/test/DebugInfo/MIR/X86/dvl-livedebugvalues-spillrestore.mir
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# A DBG_VALUE_LIST that has a component spilt and restored should had its
# expression and operands updated to refer to the stack for that period, and
# then return to normal once the value is restored.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rdi, $rsi,
# CHECK: MOV64mr $rsp, 1, $noreg, -16, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rsp, $rsi,
# CHECK: $rdi = MOV64rm $rsp, 1, $noreg, -16,
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rdi, $rsi,

--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"
; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}
; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
stack:
- { id: 0, offset: -16, size: 8, alignment: 8, type: spill-slot }
body: |
bb.0.entry:
liveins: $rdi, $rsi
$rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
MOV64mr $rsp, 1, _, -16, _, $rdi, debug-location !15 :: (store (s64) into %stack.0)
$rax = COPY killed $rdi
$rdi = MOV64ri 0
$rdi = MOV64rm $rsp, 1, $noreg, -16, $noreg, debug-location !15 :: (load (s64) from %stack.0)
RET64
...

# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# A DBG_VALUE_LIST that has a component spilt and restored should had its
# expression and operands updated to refer to the stack for that period, and
# then return to normal once the value is restored.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
#
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rdi, $rsi,
# CHECK: MOV64mr $rsp, 1, $noreg, -16, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rsp, $rsi,
# CHECK: $rdi = MOV64rm $rsp, 1, $noreg, -16,
# CHECK-NEXT: DBG_VALUE_LIST ![[VAR]],
# CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus),
# CHECK-SAME: $rdi, $rsi,

--- |
; ModuleID = 'test.cpp'
source_filename = "test.cpp"
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-unknown-linux-gnu"

; Function Attrs: norecurse nounwind readnone uwtable
define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
entry:
ret i32 0, !dbg !17
}

; Function Attrs: nounwind readnone speculatable willreturn
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_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12, !13, !14}
!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
!13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
!14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 4, column: 12, scope: !7)
!17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name: _Z3fooii
stack:
- { id: 0, offset: -16, size: 8, alignment: 8, type: spill-slot }
body: |
bb.0.entry:
liveins: $rdi, $rsi
$rsp = frame-setup SUB64ri8 $rsp, 24, implicit-def dead $eflags
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
MOV64mr $rsp, 1, _, -16, _, $rdi, debug-location !15 :: (store (s64) into %stack.0)
$rax = COPY killed $rdi
$rdi = MOV64ri 0
$rdi = MOV64rm $rsp, 1, $noreg, -16, $noreg, debug-location !15 :: (load (s64) from %stack.0)
RET64
...

218 changes: 109 additions & 109 deletions llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-movements.mir
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - | FileCheck %s
#
# Test that when a livedebugvars interval is split, DBG_VALUE_LISTs are created
# with the correct operands and exprs. Force values to be moved around between
# registers and stack through inline asm blocks that clobber things.
#
# CHECK-LABEL: bb.0.entry:
# CHECK: $rbx = COPY $rsi
# CHECK-NEXT: MOV64mr %stack.0, 1, $noreg, 0, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.0,
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rbx,
# CHECK-NEXT: CALL64pcrel32 @foo
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,
# CHECK-NEXT: $rcx = COPY killed renamable $rbx
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rcx,
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.0
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rcx,

--- |
; ModuleID = 'tmp.ll'
source_filename = "tmp.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%struct.a = type { i32 }
; Function Attrs: nounwind ssp
define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 {
entry:
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17
br label %bb3
bb1: ; preds = %bb2
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%add = add nsw i32 %tmp2, 1, !dbg !18
br label %exit
bb2: ; preds = %bb3
tail call void @llvm.dbg.value(metadata i32 %tmp2, metadata !14, metadata !DIExpression()), !dbg !17
%call = tail call i32 (...) @foo(i32 %tmp2), !dbg !19
br label %bb1
bb3: ; preds = %entry
%tmp2 = load i32, ptr %tmp1, align 4, !dbg !17
br label %bb2
exit: ; preds = %bb1
ret i32 %shoes, !dbg !18
}
declare i32 @foo(...)
; Function Attrs: nounwind readnone speculatable willreturn
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 version 2.9 (trunk 122997)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
!1 = !DIFile(filename: "bar.c", directory: "/private/tmp")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !{!9, !14}
!9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)
!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)
!12 = !{!13}
!13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)
!14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)
!15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)
!16 = !DILocation(line: 5, column: 19, scope: !4)
!17 = !DILocation(line: 6, column: 14, scope: !15)
!18 = !DILocation(line: 8, column: 2, scope: !15)
!19 = !DILocation(line: 7, column: 2, scope: !15)

...
---
name: bar
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $rdi, $rsi
%4:gr64= COPY $rsi
%2:gr64 = COPY $rdi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %2, %4, debug-location !17
%3:gr64 = COPY killed %2
%5:gr64 = COPY killed %4
; Force allocation into $rax and $rbx
INLINEASM &"", 1, 12, implicit-def dead $rcx, 12, implicit-def dead $rdx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
; Force a use of these two registers.
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
; Now make the register allocator move them to rcx and rdx!
INLINEASM &"", 1, 12, implicit-def dead $rax, 12, implicit-def dead $rbx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
RET64
...
# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - | FileCheck %s
#
# Test that when a livedebugvars interval is split, DBG_VALUE_LISTs are created
# with the correct operands and exprs. Force values to be moved around between
# registers and stack through inline asm blocks that clobber things.
#
# CHECK-LABEL: bb.0.entry:
# CHECK: $rbx = COPY $rsi
# CHECK-NEXT: MOV64mr %stack.0, 1, $noreg, 0, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.0,
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rbx,
# CHECK-NEXT: CALL64pcrel32 @foo
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rbx,
# CHECK-NEXT: $rcx = COPY killed renamable $rbx
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.0, $rcx,
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.0
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, $rcx,

--- |
; ModuleID = 'tmp.ll'
source_filename = "tmp.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

%struct.a = type { i32 }

; Function Attrs: nounwind ssp
define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 {
entry:
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17
br label %bb3

bb1: ; preds = %bb2
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%add = add nsw i32 %tmp2, 1, !dbg !18
br label %exit

bb2: ; preds = %bb3
tail call void @llvm.dbg.value(metadata i32 %tmp2, metadata !14, metadata !DIExpression()), !dbg !17
%call = tail call i32 (...) @foo(i32 %tmp2), !dbg !19
br label %bb1

bb3: ; preds = %entry
%tmp2 = load i32, ptr %tmp1, align 4, !dbg !17
br label %bb2

exit: ; preds = %bb1
ret i32 %shoes, !dbg !18
}

declare i32 @foo(...)

; Function Attrs: nounwind readnone speculatable willreturn
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 version 2.9 (trunk 122997)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
!1 = !DIFile(filename: "bar.c", directory: "/private/tmp")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !{!9, !14}
!9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)
!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)
!12 = !{!13}
!13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)
!14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)
!15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)
!16 = !DILocation(line: 5, column: 19, scope: !4)
!17 = !DILocation(line: 6, column: 14, scope: !15)
!18 = !DILocation(line: 8, column: 2, scope: !15)
!19 = !DILocation(line: 7, column: 2, scope: !15)

...
---
name: bar
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $rdi, $rsi
%4:gr64= COPY $rsi
%2:gr64 = COPY $rdi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %2, %4, debug-location !17
%3:gr64 = COPY killed %2
%5:gr64 = COPY killed %4
; Force allocation into $rax and $rbx
INLINEASM &"", 1, 12, implicit-def dead $rcx, 12, implicit-def dead $rdx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
; Force a use of these two registers.
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
; Now make the register allocator move them to rcx and rdx!
INLINEASM &"", 1, 12, implicit-def dead $rax, 12, implicit-def dead $rbx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
RET64
...
226 changes: 113 additions & 113 deletions llvm/test/DebugInfo/MIR/X86/dvl-livedebugvars-stackptr.mir
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - | FileCheck %s
#
# This is a copy of the adjacent "-movements.mir" file, but where one of the
# operands to DBG_VALUE_LIST is a stack _pointer_ rather than a spilt value.
# The expression should grow no additional derefs for the stack pointer.
#
# CHECK-LABEL: bb.0.entry:
# CHECK: $rbx = COPY $rsi
# CHECK-NEXT: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.1, %stack.0.local1
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.1,
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, %stack.0.local1,
# CHECK-NEXT: CALL64pcrel32 @foo
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.1, %stack.0.local1,
# CHECK-NEXT: $rcx = COPY killed renamable $rbx
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.1
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, %stack.0.local1,

--- |
; ModuleID = 'tmp.ll'
source_filename = "tmp.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%struct.a = type { i32 }
; Function Attrs: nounwind ssp
define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 {
entry:
%local1 = alloca i64
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17
br label %bb3
bb1: ; preds = %bb2
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%add = add nsw i32 %tmp2, 1, !dbg !18
br label %exit
bb2: ; preds = %bb3
tail call void @llvm.dbg.value(metadata i32 %tmp2, metadata !14, metadata !DIExpression()), !dbg !17
%call = tail call i32 (...) @foo(i32 %tmp2), !dbg !19
br label %bb1
bb3: ; preds = %entry
%tmp2 = load i32, ptr %tmp1, align 4, !dbg !17
br label %bb2
exit: ; preds = %bb1
ret i32 %shoes, !dbg !18
}
declare i32 @foo(...)
; Function Attrs: nounwind readnone speculatable willreturn
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 version 2.9 (trunk 122997)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
!1 = !DIFile(filename: "bar.c", directory: "/private/tmp")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !{!9, !14}
!9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)
!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)
!12 = !{!13}
!13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)
!14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)
!15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)
!16 = !DILocation(line: 5, column: 19, scope: !4)
!17 = !DILocation(line: 6, column: 14, scope: !15)
!18 = !DILocation(line: 8, column: 2, scope: !15)
!19 = !DILocation(line: 7, column: 2, scope: !15)

...
---
name: bar
tracksRegLiveness: true
stack:
- { id: 0, name: local1, type: default, offset: -24, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body: |
bb.0.entry:
liveins: $rdi, $rsi
%4:gr64= COPY $rsi
%2:gr64 = COPY $rdi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %2, %stack.0, debug-location !17
%3:gr64 = COPY killed %2
%5:gr64 = COPY killed %4
; Force allocation into $rax and $rbx
INLINEASM &"", 1, 12, implicit-def dead $rcx, 12, implicit-def dead $rdx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
; Force a use of these two registers.
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
; Now make the register allocator move them to rcx and rdx!
INLINEASM &"", 1, 12, implicit-def dead $rax, 12, implicit-def dead $rbx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
RET64
...
# RUN: llc -start-after=phi-node-elimination -stop-after=virtregrewriter %s -mtriple=x86_64-unknown-unknown -o - | FileCheck %s
#
# This is a copy of the adjacent "-movements.mir" file, but where one of the
# operands to DBG_VALUE_LIST is a stack _pointer_ rather than a spilt value.
# The expression should grow no additional derefs for the stack pointer.
#
# CHECK-LABEL: bb.0.entry:
# CHECK: $rbx = COPY $rsi
# CHECK-NEXT: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.1, %stack.0.local1
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.1,
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, %stack.0.local1,
# CHECK-NEXT: CALL64pcrel32 @foo
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_LLVM_arg, 1, DW_OP_plus), %stack.1, %stack.0.local1,
# CHECK-NEXT: $rcx = COPY killed renamable $rbx
# CHECK-NEXT: INLINEASM
# CHECK-NEXT: $rax = MOV64rm %stack.1
# CHECK-NEXT: DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rax, %stack.0.local1,

--- |
; ModuleID = 'tmp.ll'
source_filename = "tmp.ll"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

%struct.a = type { i32 }

; Function Attrs: nounwind ssp
define i32 @bar(ptr nocapture %b, i32 %shoes) !dbg !4 {
entry:
%local1 = alloca i64
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%tmp1 = getelementptr inbounds %struct.a, ptr %b, i64 0, i32 0, !dbg !17
br label %bb3

bb1: ; preds = %bb2
tail call void @llvm.dbg.value(metadata i32 %shoes, metadata !9, metadata !DIExpression()), !dbg !16
%add = add nsw i32 %tmp2, 1, !dbg !18
br label %exit

bb2: ; preds = %bb3
tail call void @llvm.dbg.value(metadata i32 %tmp2, metadata !14, metadata !DIExpression()), !dbg !17
%call = tail call i32 (...) @foo(i32 %tmp2), !dbg !19
br label %bb1

bb3: ; preds = %entry
%tmp2 = load i32, ptr %tmp1, align 4, !dbg !17
br label %bb2

exit: ; preds = %bb1
ret i32 %shoes, !dbg !18
}

declare i32 @foo(...)

; Function Attrs: nounwind readnone speculatable willreturn
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 version 2.9 (trunk 122997)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
!1 = !DIFile(filename: "bar.c", directory: "/private/tmp")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !{!9, !14}
!9 = !DILocalVariable(name: "b", arg: 1, scope: !4, file: !1, line: 5, type: !10)
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !0, baseType: !11, size: 64, align: 64)
!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", scope: !0, file: !1, line: 1, size: 32, align: 32, elements: !12)
!12 = !{!13}
!13 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !1, file: !1, line: 2, baseType: !7, size: 32, align: 32)
!14 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 6, type: !7)
!15 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 22)
!16 = !DILocation(line: 5, column: 19, scope: !4)
!17 = !DILocation(line: 6, column: 14, scope: !15)
!18 = !DILocation(line: 8, column: 2, scope: !15)
!19 = !DILocation(line: 7, column: 2, scope: !15)

...
---
name: bar
tracksRegLiveness: true
stack:
- { id: 0, name: local1, type: default, offset: -24, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body: |
bb.0.entry:
liveins: $rdi, $rsi
%4:gr64= COPY $rsi
%2:gr64 = COPY $rdi
DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), %2, %stack.0, debug-location !17
%3:gr64 = COPY killed %2
%5:gr64 = COPY killed %4
; Force allocation into $rax and $rbx
INLINEASM &"", 1, 12, implicit-def dead $rcx, 12, implicit-def dead $rdx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
; Force a use of these two registers.
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
; Now make the register allocator move them to rcx and rdx!
INLINEASM &"", 1, 12, implicit-def dead $rax, 12, implicit-def dead $rbx, 12, implicit-def dead $rsi, 12, implicit-def dead $rdi, 12, implicit-def $rbp, 12, implicit-def dead $r8, 12, implicit-def dead $r9, 12, implicit-def dead $r10, 12, implicit-def dead $r11, 12, implicit-def dead $r12, 12, implicit-def dead $r13, 12, implicit-def dead $r14, 12, implicit-def dead $r15, 12, !18, debug-location !17
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit %3, implicit %5
RET64
...
8 changes: 4 additions & 4 deletions llvm/test/DebugInfo/MIR/X86/instr-ref-join-def-vphi.mir
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "a"

# CHECK-LABEL: bb.6
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0), $esi
# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0), $esi

--- |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Expand Down Expand Up @@ -198,7 +198,7 @@ body: |
DBG_PHI $esi, 3
DBG_PHI $edi, 2
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !16
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !16
CALL64pcrel32 @"?bar@@YAHXZ", csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !19
renamable $edi = nsw SUB32rr killed renamable $edi, killed renamable $eax, implicit-def dead $eflags, debug-instr-number 1, debug-location !19
renamable $eax = IMUL32rri renamable $edi, -1431655765, implicit-def dead $eflags, debug-location !21
Expand All @@ -212,7 +212,7 @@ body: |
CALL64pcrel32 @"?bar@@YAHXZ", csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !22
renamable $esi = nsw ADD32rr killed renamable $esi, killed renamable $eax, implicit-def dead $eflags, debug-instr-number 4, debug-location !22
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(4, 0), debug-location !16
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(4, 0), debug-location !16
JMP_1 %bb.3
bb.4 (%ir-block.16):
Expand All @@ -227,7 +227,7 @@ body: |
liveins: $esi
CALL64pcrel32 @"?bar@@YAHXZ", csr_win64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !31
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(5, 0), debug-location !16
DBG_INSTR_REF !14, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(5, 0), debug-location !16
bb.6 (%ir-block.22):
liveins: $esi
Expand Down
52 changes: 26 additions & 26 deletions llvm/test/DebugInfo/PDB/Inputs/longname-truncation.yaml

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions llvm/test/DebugInfo/PDB/Inputs/merge-types-1.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
---
TpiStream:
Records:
# uint32_t* [Index: 0x1000]
- Kind: LF_POINTER
Pointer:
ReferentType: 117
Attrs: 32778
# int64_t* [Index: 0x1001]
- Kind: LF_POINTER
Pointer:
ReferentType: 118
Attrs: 32778
# struct OnlyInMerge1 [Index: 0x1002]
- Kind: LF_STRUCTURE
Class:
MemberCount: 0
Options: [ None, ForwardReference, HasUniqueName ]
FieldList: 0
Name: 'OnlyInMerge1'
UniqueName: 'OnlyInMerge1'
DerivationList: 0
VTableShape: 0
Size: 0
# uint32_t** [Index: 0x1003]
- Kind: LF_POINTER
Pointer:
ReferentType: 4096
Attrs: 32778
# uint32_t*** [Index: 0x1004]
- Kind: LF_POINTER
Pointer:
ReferentType: 4099
Attrs: 32778
# int64_t* [Index: 0x1005]
- Kind: LF_POINTER
Pointer:
ReferentType: 4097
Attrs: 32778
# [uint32_t, uint32_t*, uint32_t**] [Index: 0x1006]
- Kind: LF_ARGLIST
ArgList:
ArgIndices: [ 117, 4096, 4099 ]
# uint32_t (uint32_t, uint32_t*, uint32_t**) [Index: 0x1007]
- Kind: LF_PROCEDURE
Procedure:
ReturnType: 117
CallConv: NearC
Options: [ None ]
ParameterCount: 0
ArgumentList: 4102
...
---
TpiStream:
Records:
# uint32_t* [Index: 0x1000]
- Kind: LF_POINTER
Pointer:
ReferentType: 117
Attrs: 32778
# int64_t* [Index: 0x1001]
- Kind: LF_POINTER
Pointer:
ReferentType: 118
Attrs: 32778
# struct OnlyInMerge1 [Index: 0x1002]
- Kind: LF_STRUCTURE
Class:
MemberCount: 0
Options: [ None, ForwardReference, HasUniqueName ]
FieldList: 0
Name: 'OnlyInMerge1'
UniqueName: 'OnlyInMerge1'
DerivationList: 0
VTableShape: 0
Size: 0
# uint32_t** [Index: 0x1003]
- Kind: LF_POINTER
Pointer:
ReferentType: 4096
Attrs: 32778
# uint32_t*** [Index: 0x1004]
- Kind: LF_POINTER
Pointer:
ReferentType: 4099
Attrs: 32778
# int64_t* [Index: 0x1005]
- Kind: LF_POINTER
Pointer:
ReferentType: 4097
Attrs: 32778
# [uint32_t, uint32_t*, uint32_t**] [Index: 0x1006]
- Kind: LF_ARGLIST
ArgList:
ArgIndices: [ 117, 4096, 4099 ]
# uint32_t (uint32_t, uint32_t*, uint32_t**) [Index: 0x1007]
- Kind: LF_PROCEDURE
Procedure:
ReturnType: 117
CallConv: NearC
Options: [ None ]
ParameterCount: 0
ArgumentList: 4102
...
104 changes: 52 additions & 52 deletions llvm/test/DebugInfo/PDB/Inputs/merge-types-2.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
---
TpiStream:
Records:
# uint32_t* [Index: 0x1000]
- Kind: LF_POINTER
Pointer:
ReferentType: 117
Attrs: 32778
# uint32_t** [Index: 0x1001]
- Kind: LF_POINTER
Pointer:
ReferentType: 4096
Attrs: 32778
# uint32_t*** [Index: 0x1002]
- Kind: LF_POINTER
Pointer:
ReferentType: 4097
Attrs: 32778
# [uint32_t, uint32_t*, uint32_t**] [Index: 0x1003]
- Kind: LF_ARGLIST
ArgList:
ArgIndices: [ 117, 4096, 4097 ]
# uint32_t (uint32_t, uint32_t*, uint32_t**) [Index: 0x1004]
- Kind: LF_PROCEDURE
Procedure:
ReturnType: 117
CallConv: NearC
Options: [ None ]
ParameterCount: 0
ArgumentList: 4099
# int64_t* [Index: 0x1005]
- Kind: LF_POINTER
Pointer:
ReferentType: 118
Attrs: 32778
# int64_t** [Index: 0x1006]
- Kind: LF_POINTER
Pointer:
ReferentType: 4101
Attrs: 32778
# struct OnlyInMerge2 [Index: 0x1007]
- Kind: LF_STRUCTURE
Class:
MemberCount: 0
Options: [ None, ForwardReference, HasUniqueName ]
FieldList: 0
Name: 'OnlyInMerge2'
UniqueName: 'OnlyInMerge2'
DerivationList: 0
VTableShape: 0
Size: 0
...
---
TpiStream:
Records:
# uint32_t* [Index: 0x1000]
- Kind: LF_POINTER
Pointer:
ReferentType: 117
Attrs: 32778
# uint32_t** [Index: 0x1001]
- Kind: LF_POINTER
Pointer:
ReferentType: 4096
Attrs: 32778
# uint32_t*** [Index: 0x1002]
- Kind: LF_POINTER
Pointer:
ReferentType: 4097
Attrs: 32778
# [uint32_t, uint32_t*, uint32_t**] [Index: 0x1003]
- Kind: LF_ARGLIST
ArgList:
ArgIndices: [ 117, 4096, 4097 ]
# uint32_t (uint32_t, uint32_t*, uint32_t**) [Index: 0x1004]
- Kind: LF_PROCEDURE
Procedure:
ReturnType: 117
CallConv: NearC
Options: [ None ]
ParameterCount: 0
ArgumentList: 4099
# int64_t* [Index: 0x1005]
- Kind: LF_POINTER
Pointer:
ReferentType: 118
Attrs: 32778
# int64_t** [Index: 0x1006]
- Kind: LF_POINTER
Pointer:
ReferentType: 4101
Attrs: 32778
# struct OnlyInMerge2 [Index: 0x1007]
- Kind: LF_STRUCTURE
Class:
MemberCount: 0
Options: [ None, ForwardReference, HasUniqueName ]
FieldList: 0
Name: 'OnlyInMerge2'
UniqueName: 'OnlyInMerge2'
DerivationList: 0
VTableShape: 0
Size: 0
...
22 changes: 11 additions & 11 deletions llvm/test/DebugInfo/PDB/Inputs/one-symbol.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
DbiStream:
Modules:
- Module: one-symbol.yaml
Modi:
Records:
- Kind: S_OBJNAME
ObjNameSym:
Signature: 0
ObjectName: 'c:\foo\one-symbol.yaml'
...
---
DbiStream:
Modules:
- Module: one-symbol.yaml
Modi:
Records:
- Kind: S_OBJNAME
ObjNameSym:
Signature: 0
ObjectName: 'c:\foo\one-symbol.yaml'
...
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/PDB/pdb-longname-truncation.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
; For now just verify that this doesn't cause an error. Later we pdbdump can
; do type lookup, we can verify that the name matches what we expect.
; RUN: llvm-pdbutil yaml2pdb -pdb=%t.pdb %p/Inputs/longname-truncation.yaml
; For now just verify that this doesn't cause an error. Later we pdbdump can
; do type lookup, we can verify that the name matches what we expect.
; RUN: llvm-pdbutil yaml2pdb -pdb=%t.pdb %p/Inputs/longname-truncation.yaml
50 changes: 25 additions & 25 deletions llvm/test/DebugInfo/PDB/pdbdump-raw-bytes.test
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
; RUN: llvm-pdbutil bytes -byte-range=20-60 %p/Inputs/empty.pdb | FileCheck --check-prefix=VALID %s
; RUN: not llvm-pdbutil bytes -byte-range=100-20 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALID %s
; RUN: not llvm-pdbutil bytes -byte-range=100000-200000 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALID-RANGE %s
; RUN: llvm-pdbutil bytes -name-map %p/Inputs/empty.pdb | FileCheck --check-prefix=NAME-MAP %s
VALID: MSF Bytes
VALID-NEXT: ============================================================
VALID-NEXT: Bytes (
VALID-NEXT: 0014: 372E3030 0D0A1A44 53000000 00100000 02000000 19000000 88000000 00000000 |7.00...DS.......................|
VALID-NEXT: 0034: 18000000 00000000 00 |.........|
VALID-NEXT: )
INVALID: llvm-pdbutil: Invalid byte range specified. Max < Min
INVALID-RANGE: llvm-pdbutil: Invalid byte range specified. Requested byte larger than file size
NAME-MAP: Named Stream Map
NAME-MAP-NEXT: ============================================================
NAME-MAP-NEXT: Named Stream Map (
NAME-MAP-NEXT: 1301C: 22000000 2F4C696E 6B496E66 6F002F6E 616D6573 002F7372 632F6865 61646572 |".../LinkInfo./names./src/header|
NAME-MAP-NEXT: 1303C: 626C6F63 6B000300 00000600 00000100 00001A00 00000000 00001100 00000900 |block...........................|
NAME-MAP-NEXT: 1305C: 00000A00 00000D00 00000000 00000500 0000 |..................|
NAME-MAP-NEXT: )
; RUN: llvm-pdbutil bytes -byte-range=20-60 %p/Inputs/empty.pdb | FileCheck --check-prefix=VALID %s
; RUN: not llvm-pdbutil bytes -byte-range=100-20 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALID %s
; RUN: not llvm-pdbutil bytes -byte-range=100000-200000 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALID-RANGE %s

; RUN: llvm-pdbutil bytes -name-map %p/Inputs/empty.pdb | FileCheck --check-prefix=NAME-MAP %s


VALID: MSF Bytes
VALID-NEXT: ============================================================
VALID-NEXT: Bytes (
VALID-NEXT: 0014: 372E3030 0D0A1A44 53000000 00100000 02000000 19000000 88000000 00000000 |7.00...DS.......................|
VALID-NEXT: 0034: 18000000 00000000 00 |.........|
VALID-NEXT: )

INVALID: llvm-pdbutil: Invalid byte range specified. Max < Min

INVALID-RANGE: llvm-pdbutil: Invalid byte range specified. Requested byte larger than file size

NAME-MAP: Named Stream Map
NAME-MAP-NEXT: ============================================================
NAME-MAP-NEXT: Named Stream Map (
NAME-MAP-NEXT: 1301C: 22000000 2F4C696E 6B496E66 6F002F6E 616D6573 002F7372 632F6865 61646572 |".../LinkInfo./names./src/header|
NAME-MAP-NEXT: 1303C: 626C6F63 6B000300 00000600 00000100 00001A00 00000000 00001100 00000900 |block...........................|
NAME-MAP-NEXT: 1305C: 00000A00 00000D00 00000000 00000500 0000 |..................|
NAME-MAP-NEXT: )
138 changes: 69 additions & 69 deletions llvm/test/DebugInfo/X86/dbg-val-list-dangling.ll
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
;; At the moment we emit an undef as soon as we encounter "dangling" variadic
;; dbg_value nodes. This does not reduce correctness but does reduce coverage.
;; We should make variadic dbg_values work in the same way as their
;; non-variadic counterparts here.
;; FIXME: When dangling nodes for a variadic dbg_value are found, we should be
;; able to recover the value in some cases.

; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -o - -experimental-debug-variable-locations=false | FileCheck %s
; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -o - -experimental-debug-variable-locations=false --try-experimental-debuginfo-iterators | FileCheck %s

;; Check that dangling debug info in the SelectionDAG build phase is handled
;; in the same way for variadic dbg_value ndoes as non-variadics.

;; Generated from the following source with -g -O2. Second dbg.value modified
;; to be variadic by hand:
;; void a(char*);
;; void b() {
;; char *c = "abc";
;; char *d = "abc";
;; a("abc");
;; }

; CHECK: ![[C:[0-9]+]] = !DILocalVariable(name: "c",
; CHECK: ![[D:[0-9]+]] = !DILocalVariable(name: "d",

; CHECK-DAG: DBG_VALUE %[[VREG:[0-9]]], $noreg, ![[C]], !DIExpression(), debug-location
; CHECK-DAG: DBG_VALUE_LIST ![[D]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $noreg, debug-location

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

@.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1

define dso_local void @b() local_unnamed_addr !dbg !7 {
entry:
call void @llvm.dbg.value(metadata ptr @.str, metadata !11, metadata !DIExpression()), !dbg !15
call void @llvm.dbg.value(metadata !DIArgList(ptr @.str), metadata !14, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !15
tail call void @a(ptr @.str) #3, !dbg !16
ret void, !dbg !17
}

declare !dbg !18 dso_local void @a(ptr) local_unnamed_addr
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, producer: "clang version 11.0.0)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.c", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "b", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
!8 = !DISubroutineType(types: !9)
!9 = !{null}
!10 = !{!11, !14}
!11 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !12)
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)
!13 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!14 = !DILocalVariable(name: "d", scope: !7, file: !1, line: 4, type: !12)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 5, column: 3, scope: !7)
!17 = !DILocation(line: 6, column: 1, scope: !7)
!18 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !19, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!19 = !DISubroutineType(types: !20)
!20 = !{null, !12}
;; At the moment we emit an undef as soon as we encounter "dangling" variadic
;; dbg_value nodes. This does not reduce correctness but does reduce coverage.
;; We should make variadic dbg_values work in the same way as their
;; non-variadic counterparts here.
;; FIXME: When dangling nodes for a variadic dbg_value are found, we should be
;; able to recover the value in some cases.

; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -o - -experimental-debug-variable-locations=false | FileCheck %s
; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -o - -experimental-debug-variable-locations=false --try-experimental-debuginfo-iterators | FileCheck %s

;; Check that dangling debug info in the SelectionDAG build phase is handled
;; in the same way for variadic dbg_value ndoes as non-variadics.

;; Generated from the following source with -g -O2. Second dbg.value modified
;; to be variadic by hand:
;; void a(char*);
;; void b() {
;; char *c = "abc";
;; char *d = "abc";
;; a("abc");
;; }

; CHECK: ![[C:[0-9]+]] = !DILocalVariable(name: "c",
; CHECK: ![[D:[0-9]+]] = !DILocalVariable(name: "d",

; CHECK-DAG: DBG_VALUE %[[VREG:[0-9]]], $noreg, ![[C]], !DIExpression(), debug-location
; CHECK-DAG: DBG_VALUE_LIST ![[D]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $noreg, debug-location

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

@.str = private unnamed_addr constant [4 x i8] c"abc\00", align 1

define dso_local void @b() local_unnamed_addr !dbg !7 {
entry:
call void @llvm.dbg.value(metadata ptr @.str, metadata !11, metadata !DIExpression()), !dbg !15
call void @llvm.dbg.value(metadata !DIArgList(ptr @.str), metadata !14, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !15
tail call void @a(ptr @.str) #3, !dbg !16
ret void, !dbg !17
}

declare !dbg !18 dso_local void @a(ptr) local_unnamed_addr
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, producer: "clang version 11.0.0)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.c", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!7 = distinct !DISubprogram(name: "b", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
!8 = !DISubroutineType(types: !9)
!9 = !{null}
!10 = !{!11, !14}
!11 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !12)
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)
!13 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!14 = !DILocalVariable(name: "d", scope: !7, file: !1, line: 4, type: !12)
!15 = !DILocation(line: 0, scope: !7)
!16 = !DILocation(line: 5, column: 3, scope: !7)
!17 = !DILocation(line: 6, column: 1, scope: !7)
!18 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !19, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!19 = !DISubroutineType(types: !20)
!20 = !{null, !12}
2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/X86/dbg-value-arg-movement.ll
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
; INSTRREF: DBG_PHI $edi, 1
; INSTRREF: DBG_VALUE $edi, $noreg, [[BAZVAR]]
; INSTRREF-LABEL: bb.1.next
; INSTRREF: DBG_INSTR_REF [[XYZVAR]], {{.+}}, dbg-instr-ref(1, 0)
; INSTRREF: DBG_INSTR_REF [[XYZVAR]], {{.+}}, dbg-instr-ref(1, 0)

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/DebugInfo/X86/dbg-value-funcarg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ define dso_local void @foo_local(i32 %t1a) local_unnamed_addr #0 !dbg !7 {
; INSTRREF-NEXT: DBG_VALUE 123, $noreg, ![[LOCAL]], !DIExpression(),
; INSTRREF: CALL64pcrel32 @bar,
; INSTRREF-NEXT: ADJCALLSTACKUP64
; INSTRREF: DBG_INSTR_REF ![[LOCAL]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: DBG_INSTR_REF ![[LOCAL]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF-NOT: DBG_
; INSTRREF: TCRETURNdi64 @bar,

Expand Down Expand Up @@ -96,7 +96,7 @@ define dso_local void @foo_other_param(i32 %t2a, i32 %t2b) local_unnamed_addr #0
; INSTRREF: CALL64pcrel32 @bar,
; INSTRREF: DBG_VALUE 123, $noreg, ![[T2B]], !DIExpression(),
; INSTRREF: CALL64pcrel32 @bar,
; INSTRREF: DBG_INSTR_REF ![[T2B]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: DBG_INSTR_REF ![[T2B]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: TCRETURNdi64 @bar,

entry:
Expand Down Expand Up @@ -125,10 +125,10 @@ define dso_local void @foo_same_param(i32 %t3a) local_unnamed_addr #0 !dbg !31 {
; INSTRREF: DBG_PHI $edi, 1
; INSTRREF: DBG_VALUE $edi, $noreg, ![[T3A]], !DIExpression(),
; INSTRREF: CALL64pcrel32 @bar,
; INSTRREF: DBG_INSTR_REF ![[TMP]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: DBG_INSTR_REF ![[TMP]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: DBG_VALUE 123, $noreg, ![[T3A]], !DIExpression(),
; INSTRREF: CALL64pcrel32 @bar,
; INSTRREF: DBG_INSTR_REF ![[T3A]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: DBG_INSTR_REF ![[T3A]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0),
; INSTRREF: TCRETURNdi64 @bar,
entry:
call void @llvm.dbg.value(metadata i32 %t3a, metadata !33, metadata !DIExpression()), !dbg !35
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/X86/dbg-value-funcarg2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ define dso_local i32 @f(i64 %s1.coerce0, i64 %s1.coerce1, i64 %s2.coerce0, i64 %
;; of the earlier DBG_PHIs.
; INSTRREF: ADJCALLSTACKUP
; INSTRREF-NOT: DBG_
; INSTRREF-DAG: DBG_INSTR_REF ![[S1]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 0, 64), dbg-instr-ref(1, 0)
; INSTRREF-DAG: DBG_INSTR_REF ![[S1]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 64, 64), dbg-instr-ref(2, 0)
; INSTRREF-DAG: DBG_INSTR_REF ![[S1]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 0, 64), dbg-instr-ref(1, 0)
; INSTRREF-DAG: DBG_INSTR_REF ![[S1]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 64, 64), dbg-instr-ref(2, 0)

; And then no more DBG_ instructions before the add.
; COMMON-NOT: DBG_
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/X86/dbg-value-funcarg4.ll
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

; CHECK: DBG_PHI $edi, 1

; CHECK: DBG_INSTR_REF ![[LOCAL]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
; CHECK: DBG_INSTR_REF ![[LOCAL2]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
; CHECK: DBG_INSTR_REF ![[LOCAL]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
; CHECK: DBG_INSTR_REF ![[LOCAL2]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)

declare void @bar(i32)
declare void @llvm.dbg.value(metadata, metadata, metadata)
Expand Down
122 changes: 61 additions & 61 deletions llvm/test/DebugInfo/X86/dbg-value-list-dag-combine.ll
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
; RUN: llc < %s -start-after=codegenprepare -stop-before=finalize-isel | FileCheck %s --implicit-check-not=DBG_VALUE

;; Test for PR 9817 adapted for variadic dbg.values (those using !DIArgList) by
;; hand. The debug nodes for idx and gid are transferred to new nodes via
;; TransferDbgValue. There should be a DEBUG_VALUE_LIST for each call to
;; llvm.dbg.value.

; CHECK-DAG: ![[ip:[0-9]+]] = !DILocalVariable(name: "ip",
; CHECK-DAG: ![[gid:[0-9]+]] = !DILocalVariable(name: "gid",
; CHECK-DAG: ![[xxx:[0-9]+]] = !DILocalVariable(name: "xxx",
; CHECK-DAG: ![[idx:[0-9]+]] = !DILocalVariable(name: "idx",

; CHECK: DBG_VALUE_LIST ![[ip]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),
; CHECK: DBG_VALUE_LIST ![[gid]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),
;; Constant value dbg.value should keep its value.
; CHECK: DBG_VALUE_LIST ![[xxx]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), 0
; CHECK: DBG_VALUE_LIST ![[idx]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
target triple = "i686-apple-darwin"

declare <4 x i32> @__amdil_get_global_id_int()
declare void @llvm.dbg.value(metadata, metadata, metadata)
define void @__OpenCL_test_kernel(ptr addrspace(1) %ip) nounwind !dbg !0 {
entry:
call void @llvm.dbg.value(metadata !DIArgList(ptr addrspace(1) %ip), metadata !7, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !8
%0 = call <4 x i32> @__amdil_get_global_id_int() nounwind
%1 = extractelement <4 x i32> %0, i32 0
call void @llvm.dbg.value(metadata !DIArgList(i32 %1), metadata !9, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !11
call void @llvm.dbg.value(metadata !DIArgList(i32 0), metadata !21, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !14
%tmp2 = load i32, ptr addrspace(1) %ip, align 4, !dbg !15
%tmp3 = add i32 0, %tmp2, !dbg !15
call void @llvm.dbg.value(metadata !DIArgList(i32 %tmp3), metadata !13, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !15
%arrayidx = getelementptr i32, ptr addrspace(1) %ip, i32 %1, !dbg !16
store i32 %tmp3, ptr addrspace(1) %arrayidx, align 4, !dbg !16
ret void, !dbg !17
}
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!20}

!0 = distinct !DISubprogram(name: "__OpenCL_test_kernel", linkageName: "__OpenCL_test_kernel", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2, file: !19, scope: !1, type: !3)
!1 = !DIFile(filename: "OCL6368.tmp.cl", directory: "E:CUsersCmvillmow.AMDCAppDataCLocalCTemp")
!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clc", isOptimized: false, emissionKind: FullDebug, file: !19, enums: !12, retainedTypes: !12, imports: null)
!3 = !DISubroutineType(types: !4)
!4 = !{null, !5}
!5 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !6)
!6 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
!7 = !DILocalVariable(name: "ip", line: 1, arg: 1, scope: !0, file: !1, type: !5)
!8 = !DILocation(line: 1, column: 42, scope: !0)
!9 = !DILocalVariable(name: "gid", line: 3, scope: !10, file: !1, type: !6)
!10 = distinct !DILexicalBlock(line: 2, column: 1, file: !19, scope: !0)
!11 = !DILocation(line: 3, column: 41, scope: !10)
!12 = !{}
!13 = !DILocalVariable(name: "idx", line: 4, scope: !10, file: !1, type: !6)
!14 = !DILocation(line: 4, column: 20, scope: !10)
!15 = !DILocation(line: 5, column: 15, scope: !10)
!16 = !DILocation(line: 6, column: 18, scope: !10)
!17 = !DILocation(line: 7, column: 1, scope: !0)
!19 = !DIFile(filename: "OCL6368.tmp.cl", directory: "E:\5CUsers\5Cmvillmow.AMD\5CAppData\5CLocal\5CTemp")
!20 = !{i32 1, !"Debug Info Version", i32 3}
!21 = !DILocalVariable(name: "xxx", line: 4, scope: !10, file: !1, type: !6)
; RUN: llc < %s -start-after=codegenprepare -stop-before=finalize-isel | FileCheck %s --implicit-check-not=DBG_VALUE

;; Test for PR 9817 adapted for variadic dbg.values (those using !DIArgList) by
;; hand. The debug nodes for idx and gid are transferred to new nodes via
;; TransferDbgValue. There should be a DEBUG_VALUE_LIST for each call to
;; llvm.dbg.value.

; CHECK-DAG: ![[ip:[0-9]+]] = !DILocalVariable(name: "ip",
; CHECK-DAG: ![[gid:[0-9]+]] = !DILocalVariable(name: "gid",
; CHECK-DAG: ![[xxx:[0-9]+]] = !DILocalVariable(name: "xxx",
; CHECK-DAG: ![[idx:[0-9]+]] = !DILocalVariable(name: "idx",

; CHECK: DBG_VALUE_LIST ![[ip]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),
; CHECK: DBG_VALUE_LIST ![[gid]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),
;; Constant value dbg.value should keep its value.
; CHECK: DBG_VALUE_LIST ![[xxx]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), 0
; CHECK: DBG_VALUE_LIST ![[idx]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value),

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32"
target triple = "i686-apple-darwin"

declare <4 x i32> @__amdil_get_global_id_int()
declare void @llvm.dbg.value(metadata, metadata, metadata)
define void @__OpenCL_test_kernel(ptr addrspace(1) %ip) nounwind !dbg !0 {
entry:
call void @llvm.dbg.value(metadata !DIArgList(ptr addrspace(1) %ip), metadata !7, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !8
%0 = call <4 x i32> @__amdil_get_global_id_int() nounwind
%1 = extractelement <4 x i32> %0, i32 0
call void @llvm.dbg.value(metadata !DIArgList(i32 %1), metadata !9, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !11
call void @llvm.dbg.value(metadata !DIArgList(i32 0), metadata !21, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !14
%tmp2 = load i32, ptr addrspace(1) %ip, align 4, !dbg !15
%tmp3 = add i32 0, %tmp2, !dbg !15
call void @llvm.dbg.value(metadata !DIArgList(i32 %tmp3), metadata !13, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !15
%arrayidx = getelementptr i32, ptr addrspace(1) %ip, i32 %1, !dbg !16
store i32 %tmp3, ptr addrspace(1) %arrayidx, align 4, !dbg !16
ret void, !dbg !17
}
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!20}

!0 = distinct !DISubprogram(name: "__OpenCL_test_kernel", linkageName: "__OpenCL_test_kernel", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2, file: !19, scope: !1, type: !3)
!1 = !DIFile(filename: "OCL6368.tmp.cl", directory: "E:CUsersCmvillmow.AMDCAppDataCLocalCTemp")
!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clc", isOptimized: false, emissionKind: FullDebug, file: !19, enums: !12, retainedTypes: !12, imports: null)
!3 = !DISubroutineType(types: !4)
!4 = !{null, !5}
!5 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, scope: !2, baseType: !6)
!6 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
!7 = !DILocalVariable(name: "ip", line: 1, arg: 1, scope: !0, file: !1, type: !5)
!8 = !DILocation(line: 1, column: 42, scope: !0)
!9 = !DILocalVariable(name: "gid", line: 3, scope: !10, file: !1, type: !6)
!10 = distinct !DILexicalBlock(line: 2, column: 1, file: !19, scope: !0)
!11 = !DILocation(line: 3, column: 41, scope: !10)
!12 = !{}
!13 = !DILocalVariable(name: "idx", line: 4, scope: !10, file: !1, type: !6)
!14 = !DILocation(line: 4, column: 20, scope: !10)
!15 = !DILocation(line: 5, column: 15, scope: !10)
!16 = !DILocation(line: 6, column: 18, scope: !10)
!17 = !DILocation(line: 7, column: 1, scope: !0)
!19 = !DIFile(filename: "OCL6368.tmp.cl", directory: "E:\5CUsers\5Cmvillmow.AMD\5CAppData\5CLocal\5CTemp")
!20 = !{i32 1, !"Debug Info Version", i32 3}
!21 = !DILocalVariable(name: "xxx", line: 4, scope: !10, file: !1, type: !6)
168 changes: 84 additions & 84 deletions llvm/test/DebugInfo/X86/dbg_value_list_clobbers.mir
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
# RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \
# RUN: | llvm-dwarfdump - -name locala -o - | FileCheck %s
#
# Test that clobbers between DBG_VALUE_LIST and DBG_VALUE instructions work as
# expected. Comments and test directives inline.

--- |
target triple = "x86_64-unknown-linux-gnu"
define dso_local i32 @fun() local_unnamed_addr !dbg !7 {
entry:
ret i32 0
}

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

!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "example.c", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!8 = !DISubroutineType(types: !9)
!9 = !{!10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12}
!22 = !DISubroutineType(types: !23)
!23 = !{!10, !10}
; --- Important metadata ---
!7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!15 = !DILocation(line: 1, column: 1, scope: !7)
!12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)

...
---
name: fun
body: |
bb.0.entry:
; This test checks that we see expected location ranges for a single variable.
; CHECK: {{.*}} DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}}
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $eax, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
$edi = MOV32ri 1
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $esi, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg4 RSI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
$eax = MOV32ri 2
DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_reg0 RAX
$ecx = MOV32ri 3
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
; Check that a reg clobber prevents identical locations merging.
$ecx = MOV32ri 4
$ecx = MOV32ri 5
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
; Check that fragments are composed correctly.
$ecx = MOV32ri 6
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 16), $eax, debug-location !15
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
; Check that fragments clobber preceeding overlap.
$edi = MOV32ri 7
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $edi, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg5 RDI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
; Check that a (non-zero-offset) fragment works.
$ecx = MOV32ri 8
$ecx = MOV32ri 9
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x2
RET64 debug-location !15
...
# RUN: llc %s --start-after=livedebugvalues -filetype=obj -o - \
# RUN: | llvm-dwarfdump - -name locala -o - | FileCheck %s
#
# Test that clobbers between DBG_VALUE_LIST and DBG_VALUE instructions work as
# expected. Comments and test directives inline.

--- |
target triple = "x86_64-unknown-linux-gnu"
define dso_local i32 @fun() local_unnamed_addr !dbg !7 {
entry:
ret i32 0
}

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

!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "example.c", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang version 11.0.0"}
!8 = !DISubroutineType(types: !9)
!9 = !{!10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !{!12}
!22 = !DISubroutineType(types: !23)
!23 = !{!10, !10}
; --- Important metadata ---
!7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
!15 = !DILocation(line: 1, column: 1, scope: !7)
!12 = !DILocalVariable(name: "locala", scope: !7, file: !1, line: 1, type: !10)

...
---
name: fun
body: |
bb.0.entry:
; This test checks that we see expected location ranges for a single variable.
; CHECK: {{.*}} DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}}
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $eax, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
$edi = MOV32ri 1
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), $esi, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg4 RSI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value
$eax = MOV32ri 2
DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_reg0 RAX
$ecx = MOV32ri 3
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
; Check that a reg clobber prevents identical locations merging.
$ecx = MOV32ri 4
$ecx = MOV32ri 5
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value
; Check that fragments are composed correctly.
$ecx = MOV32ri 6
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 16), $eax, debug-location !15
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
; Check that fragments clobber preceeding overlap.
$edi = MOV32ri 7
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $edi, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg5 RDI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2
; Check that a (non-zero-offset) fragment works.
$ecx = MOV32ri 8
$ecx = MOV32ri 9
DBG_VALUE_LIST !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16), $eax, $ecx, debug-location !15
; CHECK-NEXT: [{{.*}}): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_stack_value, DW_OP_piece 0x2, DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_breg2 RCX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x2
RET64 debug-location !15
...
Loading