[llvm] 211efaa - Reapply "[DebugInfo] Extend the InstrRef LDV to support DbgValues with many Ops"
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 06:21:06 PDT 2022
Author: Stephen Tozer
Date: 2022-09-01T14:20:24+01:00
New Revision: 211efaa1ce8164cc27f96acdee7777969e2a2bcf
URL: https://github.com/llvm/llvm-project/commit/211efaa1ce8164cc27f96acdee7777969e2a2bcf
DIFF: https://github.com/llvm/llvm-project/commit/211efaa1ce8164cc27f96acdee7777969e2a2bcf.diff
LOG: Reapply "[DebugInfo] Extend the InstrRef LDV to support DbgValues with many Ops"
Re-landing with an erroneous assert removed.
This reverts commit 58d104b352a65bec3fb7a8fd23bf2d408b4c76f7.
Added:
Modified:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir
llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir
llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
llvm/test/DebugInfo/MIR/X86/live-debug-values-stack-clobber.mir
Removed:
llvm/test/DebugInfo/MIR/InstrRef/ignore-dbg-value-list.mir
################################################################################
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 9aea7903a7c40..87ccfc187744a 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -805,9 +805,6 @@ class TransferTracker {
assert(LostMLocIt != ActiveMLocs.end() &&
"Variable was using this MLoc, but ActiveMLocs[MLoc] has no "
"entries?");
- assert(LostMLocIt->second.contains(LocVarIt.second) &&
- "Variable was using this MLoc, but does not appear in "
- "ActiveMLocs?");
LostMLocIt->second.erase(LocVarIt.second);
}
@@ -1341,19 +1338,6 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
if (Scope == nullptr)
return true; // handled it; by doing nothing
- // For now, ignore DBG_VALUE_LISTs when extending ranges. Allow it to
- // contribute to locations in this block, but don't propagate further.
- // Interpret it like a DBG_VALUE $noreg.
- if (MI.isDebugValueList()) {
- SmallVector<DbgOpID> EmptyDebugOps;
- SmallVector<ResolvedDbgOp> EmptyResolvedDebugOps;
- if (VTracker)
- VTracker->defVar(MI, Properties, EmptyDebugOps);
- if (TTracker)
- TTracker->redefVar(MI, Properties, EmptyResolvedDebugOps);
- return true;
- }
-
// MLocTracker needs to know that this register is read, even if it's only
// read by a debug inst.
for (const MachineOperand &MO : MI.debug_operands())
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 73a76db8aa896..879bdf75fb3dd 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -979,7 +979,6 @@ class VLocTracker {
void defVar(const MachineInstr &MI, const DbgValueProperties &Properties,
const SmallVectorImpl<DbgOpID> &DebugOps) {
assert(MI.isDebugValue() || MI.isDebugRef());
- assert(DebugOps.size() <= 1);
DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(),
MI.getDebugLoc()->getInlinedAt());
DbgValue Rec = (DebugOps.size() > 0)
diff --git a/llvm/test/DebugInfo/MIR/InstrRef/ignore-dbg-value-list.mir b/llvm/test/DebugInfo/MIR/InstrRef/ignore-dbg-value-list.mir
deleted file mode 100644
index f9728d073c6d0..0000000000000
--- a/llvm/test/DebugInfo/MIR/InstrRef/ignore-dbg-value-list.mir
+++ /dev/null
@@ -1,74 +0,0 @@
-# RUN: llc %s -o - -mtriple=x86_64-unknown-unknown \
-# RUN: -experimental-debug-variable-locations -run-pass=livedebugvalues\
-# RUN: | FileCheck %s --implicit-check-not=DBG_VALUE \
-# RUN: --implicit-check-not=DBG_VALUE_LIST
-#
-# Test that any DBG_VALUE_LISTs observed are interpreted as DBG_VALUE $noreg.
-# This is obviously sub-optimal, but avoids false variable locations, for the
-# period of time until InstrRefBasedLDV supports these variable locations.
-#
---- |
- 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"
-
- define dso_local i32 @foo() !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, 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: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)
- !13 = !DILocation(line: 0, scope: !7)
- !14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
-
-...
----
-name: foo
-alignment: 16
-tracksRegLiveness: true
-machineFunctionInfo: {}
-body: |
- bb.0:
- liveins: $rdi, $rsi, $r14, $rbx
-
- ; CHECK-LABEL: bb.0:
- $rax = MOV64ri 0, debug-location !13
- $rbx = MOV64ri 0, debug-location !13
- DBG_VALUE_LIST !12, !DIExpression(), $rax, $rbx, debug-location !13
- ; CHECK: DBG_VALUE_LIST
-
- bb.1:
- liveins: $rax
-
- ; CHECK-LABEL: bb.1:
- ; Earlier DBG_VALUE_LIST should not be propagated here, would be caught
- ; by implicit check not on FileCheck cmdline.
-
- DBG_VALUE $rax, $noreg, !12, !DIExpression(), debug-location !13
- ; CHECK: DBG_VALUE
- $rbx = MOV64ri 0, debug-location !13
- DBG_VALUE_LIST !12, !DIExpression(), $rax, $rbx, debug-location !13
- ; CHECK: DBG_VALUE_LIST
- $rbx = COPY killed $rax, debug-location !13
- $rax = MOV64ri 0, debug-location !13
- ; This clobber of $rax might cause LDV to re-issue a DBG_VALUE stating the
- ; variable location as $rbx. However, the preceeding DBG_VALUE_LIST should
- ; terminate the earlier location.
- RET64 implicit $rbx, debug-location !13
-
-...
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir
index eef53c0a466cc..1d6bf70859992 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir
@@ -17,8 +17,14 @@
# CHECK-LABEL: bb.3.bb3:
# CHECK: DBG_VALUE $ecx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 0, 32)
+# CHECK-SAME: $ecx, $r8d
# CHECK-NEXT: DBG_VALUE $ebx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 32, 32)
+# CHECK-SAME: $ebx, $r10d
# CHECK-NEXT: XOR32rr
# CHECK-NEXT: RET64
#
@@ -26,30 +32,55 @@
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 0, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 0, 16)
+# CHECK-SAME: $cx, $r8w
# CHECK-LABEL: bb.1.bb1:
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 0, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 0, 16)
+# CHECK-SAME: $cx, $r8w
+# CHECK-NEXT: MOV32rr
# CHECK-NEXT: MOV32rr
# CHECK-NEXT: DBG_VALUE $ax, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 8, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 8, 16)
+# CHECK-SAME: $ax, $r9w
# CHECK-NEXT: JMP_1
# CHECK-LABEL: bb.2.bb2:
# CHECK-NOT: DBG_VALUE
+# CHECK-NOT: DBG_VALUE_LIST
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 8, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 8, 16)
+# CHECK-SAME: $cx, $r8w
+# CHECK-NEXT: MOV32rr
+# CHECK-NEXT: ADD32ri8
# CHECK-NEXT: MOV32rr
# CHECK-NEXT: ADD32ri8
# CHECK-NEXT: DBG_VALUE $ebx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 32, 32)
+# CHECK-SAME: $ebx, $r10d
# CHECK-NEXT: JMP_1
# CHECK-LABEL: bb.3.bb3:
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 8, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 8, 16)
+# CHECK-SAME: $cx, $r8w
# CHECK-NEXT: DBG_VALUE $ebx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 32, 32)
+# CHECK-SAME: $ebx, $r10d
# CHECK-NEXT: XOR32rr
# CHECK-NEXT: RET64
@@ -57,29 +88,49 @@
# CHECK-LABEL: bb.0.entry:
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 0, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 0, 16)
+# CHECK-SAME: $cx, $r8w
# CHECK-NEXT: JMP_1 %bb.1
#
# CHECK-LABEL: bb.1.bb1:
# CHECK: DBG_VALUE $cx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 0, 16)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 0, 16)
+# CHECK-SAME: $cx, $r8w
+# CHECK-NEXT: MOV32rr
# CHECK-NEXT: MOV32rr
# CHECK-NEXT: DBG_VALUE $rdi, $noreg, !{{[0-9]+}}, !DIExpression()
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}}, !DIExpression({{[^)]+}}), $rdi, $rdi
# CHECK-NEXT: JMP_1 %bb.2
#
# CHECK-LABEL: bb.2.bb2:
# CHECK-NOT: DBG_VALUE $cx
+# CHECK-NOT: DBG_VALUE_LIST {{.+}}, $cx
# CHECK: DBG_VALUE $rdi, $noreg, !{{[0-9]+}}, !DIExpression()
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}}, !DIExpression({{[^)]+}}), $rdi, $rdi
+# CHECK-NEXT: MOV32rr
+# CHECK-NEXT: ADD32ri8
# CHECK-NEXT: MOV32rr
# CHECK-NEXT: ADD32ri8
# CHECK-NEXT: DBG_VALUE $ebx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 32, 32)
+# CHECK-SAME: $ebx, $r10d
# CHECK-NEXT: JMP_1 %bb.3
#
# CHECK-LABEL: bb.3.bb3:
# CHECK-NOT: DBG_VALUE $rdi
# CHECK-NOT: DBG_VALUE $cx
+# CHECK-NOT: DBG_VALUE_LIST {{.+}}, $rdi
+# CHECK-NOT: DBG_VALUE_LIST {{.+}}, $cx
# CHECK: DBG_VALUE $ebx, $noreg, !{{[0-9]+}},
# CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+# CHECK-NEXT: DBG_VALUE_LIST !{{[0-9]+}},
+# CHECK-SAME: !DIExpression({{[^)]+}}, DW_OP_LLVM_fragment, 32, 32)
+# CHECK-SAME: $ebx, $r10d
# CHECK-NEXT: XOR32rr
# CHECK-NEXT: RET64
@@ -129,19 +180,23 @@
!2 = !DIFile(filename: "bees.cpp", directory: ".")
!3 = !DILocalVariable(name: "flannel", scope: !4, file: !2, line: 1, type: !16)
!4 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !13, type: !14, isDefinition: true)
+ !5 = !DILocalVariable(name: "panel", scope: !4, file: !2, line: 1, type: !16)
!8 = !DILocation(line: 4, scope: !4)
- !13 = !{!3}
+ !13 = !{!3, !5}
!14 = !DISubroutineType(types: !15)
!15 = !{!16}
!16 = !DIBasicType(name: "looong", size: 64, align: 64, encoding: DW_ATE_signed)
!40 = distinct !DISubprogram(name: "toast", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !53, type: !14, isDefinition: true)
!43 = !DILocalVariable(name: "charm", scope: !40, file: !2, line: 1, type: !16)
+ !44 = !DILocalVariable(name: "calm", scope: !40, file: !2, line: 1, type: !16)
!48 = !DILocation(line: 4, scope: !40)
- !53 = !{!43}
+ !53 = !{!43, !44}
!80 = distinct !DISubprogram(name: "mort", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !93, type: !14, isDefinition: true)
+ !81 = distinct !DISubprogram(name: "floor", scope: !2, file: !2, line: 1, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !93, type: !14, isDefinition: true)
!83 = !DILocalVariable(name: "bodkin", scope: !80, file: !2, line: 1, type: !16)
+ !84 = !DILocalVariable(name: "goblin", scope: !80, file: !2, line: 1, type: !16)
!88 = !DILocation(line: 4, scope: !80)
- !93 = !{!83}
+ !93 = !{!83, !84}
...
---
@@ -156,27 +211,33 @@ body: |
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
+ $r8d = XOR32rr undef $r8d, undef $r8d, implicit-def $eflags
JMP_1 %bb.1
bb.1.bb1 (align 4):
successors: %bb.2
- liveins: $ecx, $rdi
+ liveins: $ecx, $edx, $rdi, $r8d
$eax = MOV32rr killed $ecx, implicit-def $rax
+ $r9d = MOV32rr killed $r8d, implicit-def $r9
DBG_VALUE $eax, $noreg, !3, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !8
+ DBG_VALUE_LIST !5, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 0, 32), $eax, $r9d, debug-location !8
JMP_1 %bb.2
bb.2.bb2:
successors: %bb.3
- liveins: $eax
+ liveins: $eax, $r9d
$ebx = MOV32rr $eax
$ebx = ADD32ri8 $ebx, 3, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
+ $r10d = MOV32rr $r9d
+ $r10d = ADD32ri8 $r10d, 3, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
DBG_VALUE $ebx, $noreg, !3, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !8
+ DBG_VALUE_LIST !5, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 32, 32), $ebx, $r10d, debug-location !8
JMP_1 %bb.3
bb.3.bb3:
- liveins: $eax, $ebx
+ liveins: $eax, $ebx, $r9d, $r10d
$eax = XOR32rr killed $eax, killed $ebx, implicit-def $eflags
RET64 $eax, debug-location !8
@@ -193,28 +254,35 @@ body: |
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
+ $r8d = XOR32rr undef $r8d, undef $r8d, implicit-def $eflags
DBG_VALUE $cx, $noreg, !43, !DIExpression(DW_OP_LLVM_fragment, 0, 16), debug-location !48
+ DBG_VALUE_LIST !44, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 0, 16), $cx, $r8w, debug-location !48
JMP_1 %bb.1
bb.1.bb1:
successors: %bb.2
- liveins: $ecx, $rdi
+ liveins: $ecx, $r8d, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
+ $r9d = MOV32rr killed $r8d, implicit-def $rax
DBG_VALUE $ax, $noreg, !43, !DIExpression(DW_OP_LLVM_fragment, 8, 16), debug-location !48
+ DBG_VALUE_LIST !44, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 8, 16), $ax, $r9w, debug-location !48
JMP_1 %bb.2
bb.2.bb2:
successors: %bb.3
- liveins: $eax
+ liveins: $eax, $r9d
$ebx = MOV32rr $eax
$ebx = ADD32ri8 $ebx, 3, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
+ $r10d = MOV32rr $r9d
+ $r10d = ADD32ri8 $r10d, 3, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
DBG_VALUE $ebx, $noreg, !43, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !48
+ DBG_VALUE_LIST !44, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 32, 32), $ebx, $r10d, debug-location !48
JMP_1 %bb.3
bb.3.bb3:
- liveins: $eax, $ebx
+ liveins: $eax, $ebx, $r9d, $r10d
$eax = XOR32rr killed $eax, killed $ebx, implicit-def $eflags
RET64 $eax, debug-location !48
@@ -231,24 +299,31 @@ body: |
liveins: $rdi
$ecx = XOR32rr undef $ecx, undef $ecx, implicit-def $eflags
+ $r8d = XOR32rr undef $r8d, undef $r8d, implicit-def $eflags
DBG_VALUE $cx, $noreg, !83, !DIExpression(DW_OP_LLVM_fragment, 0, 16), debug-location !88
+ DBG_VALUE_LIST !84, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 0, 16), $cx, $r8w, debug-location !88
JMP_1 %bb.1
bb.1.bb1:
successors: %bb.2
- liveins: $ecx, $rdi
+ liveins: $ecx, $r8d, $rdi
$eax = MOV32rr killed $ecx, implicit-def $rax
+ $r9d = MOV32rr killed $r8d, implicit-def $r9
DBG_VALUE $rdi, $noreg, !83, !DIExpression(), debug-location !88
+ DBG_VALUE_LIST !84, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rdi, debug-location !88
JMP_1 %bb.2
bb.2.bb2:
successors: %bb.3
- liveins: $eax
+ liveins: $eax, $r9d
$ebx = MOV32rr $eax
$ebx = ADD32ri8 $ebx, 3, implicit-def dead $eflags, implicit killed $rbx, implicit-def $rbx
+ $r10d = MOV32rr $r9d
+ $r10d = ADD32ri8 $r10d, 3, implicit-def dead $eflags, implicit killed $r10, implicit-def $r10
DBG_VALUE $ebx, $noreg, !83, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !88
+ DBG_VALUE_LIST !84, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_LLVM_fragment, 32, 32), $ebx, $r10d, debug-location !88
JMP_1 %bb.3
bb.3.bb3:
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir
index bf97e7a5e09db..e5d751d994aa8 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir
@@ -5,9 +5,14 @@
# to another. The altered instructions are labeled below.
#
# CHECK: ![[ARG1:.*]] = !DILocalVariable(name: "arg1"
+# CHECK: ![[VAR1:.*]] = !DILocalVariable(name: "var1"
# CHECK: DBG_VALUE $ebx, $noreg, ![[ARG1]], !DIExpression(), debug-location
+# CHECK: DBG_VALUE_LIST ![[VAR1]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $ebx, $r13d
# CHECK: $r12d = MOV32rr killed $ebx, implicit-def $r12
+# CHECK-NEXT: DBG_VALUE_LIST !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $r12d, $r13d
# CHECK-NEXT: DBG_VALUE $r12d, $noreg, ![[ARG1]], !DIExpression(), debug-location
+# CHECK: $r10d = MOV32rr killed $r13d, implicit-def $r10
+# CHECK-NEXT: DBG_VALUE_LIST !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $r12d, $r10d
--- |
; ModuleID = 'live-debug-values-reg-copy.ll'
source_filename = "live-debug-values-reg-copy.c"
@@ -88,8 +93,9 @@
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
- !11 = !{!12}
+ !11 = !{!12, !13}
!12 = !DILocalVariable(name: "arg1", arg: 1, scope: !7, file: !1, line: 6, type: !10)
+ !13 = !DILocalVariable(name: "var1", arg: 1, scope: !7, file: !1, line: 6, type: !10)
!15 = !DILocation(line: 6, column: 13, scope: !7)
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !22, i64 0}
@@ -108,13 +114,14 @@ tracksRegLiveness: true
registers:
liveins:
- { reg: '$edi', virtual-reg: '' }
+ - { reg: '$r8d', virtual-reg: '' }
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
- stackSize: 40
- offsetAdjustment: -40
+ stackSize: 48
+ offsetAdjustment: -48
maxAlignment: 4
adjustsStack: true
hasCalls: true
@@ -126,12 +133,16 @@ frameInfo:
savePoint: ''
restorePoint: ''
fixedStack:
- - { id: 0, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
+ - { id: 0, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbx', callee-saved-restored: true }
- - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
+ - { id: 1, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
callee-saved-register: '$r12', callee-saved-restored: true }
- - { id: 2, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
+ - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$rbp', callee-saved-restored: true }
+ - { id: 3, type: spill-slot, offset: -24, size: 8, alignment: 16, stack-id: default,
+ callee-saved-register: '$r13', callee-saved-restored: true }
+ - { id: 4, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
+ callee-saved-register: '$r10', callee-saved-restored: true }
stack:
- { id: 0, name: local1, type: default, offset: -36, size: 4, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
@@ -140,27 +151,39 @@ constants:
body: |
bb.0.entry:
successors: %bb.1(0x40000000), %bb.2(0x40000000)
- liveins: $edi, $rbp, $r12, $rbx
+ liveins: $edi, $rbp, $r8, $r10, $r13, $r12, $rbx
DBG_VALUE $edi, $noreg, !12, !DIExpression(), debug-location !15
- frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
+ DBG_VALUE_LIST !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $edi, $r8d, debug-location !15
+ frame-setup PUSH64r killed $r10, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 16
- frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 24
- frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
+ frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 32
- $rsp = frame-setup SUB64ri8 $rsp, 16, implicit-def dead $eflags
+ frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 40
+ frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 48
- CFI_INSTRUCTION offset $rbx, -32
- CFI_INSTRUCTION offset $r12, -24
- CFI_INSTRUCTION offset $rbp, -16
+ $rsp = frame-setup SUB64ri8 $rsp, 16, implicit-def dead $eflags
+ CFI_INSTRUCTION def_cfa_offset 56
+ CFI_INSTRUCTION offset $rbx, -48
+ CFI_INSTRUCTION offset $rbx, -40
+ CFI_INSTRUCTION offset $r12, -32
+ CFI_INSTRUCTION offset $rbp, -24
+ CFI_INSTRUCTION offset $r13, -16
renamable $ebx = COPY $edi, implicit-def $rbx
+ renamable $r13d = COPY $r8d, implicit-def $r13
DBG_VALUE $ebx, $noreg, !12, !DIExpression(), debug-location !15
+ DBG_VALUE_LIST !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $ebx, $r13d, debug-location !15
renamable $rdi = LEA64r $rsp, 1, $noreg, 12, $noreg
+ renamable $r8 = LEA64r $rsp, 1, $noreg, 12, $noreg
CALL64pcrel32 @init, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, debug-location !15
renamable $edi = MOV32rm $rsp, 1, $noreg, 12, $noreg :: (dereferenceable load (s32) from %ir.local1, !tbaa !20)
renamable $edi = ADD32rr killed renamable $edi, renamable $ebx, implicit-def dead $eflags, debug-location !15
- CALL64pcrel32 @coeficient, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !15
+ renamable $r8d = MOV32rm $rsp, 1, $noreg, 12, $noreg :: (dereferenceable load (s32) from %ir.local1, !tbaa !20)
+ renamable $r8d = ADD32rr killed renamable $r8d, renamable $r13d, implicit-def dead $eflags, debug-location !15
+ CALL64pcrel32 @coeficient, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $r8d, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !15
renamable $ebp = COPY $eax, debug-location !15
CMP32ri8 $eax, 33, implicit-def $eflags, debug-location !15
JCC_1 %bb.2, 12, implicit killed $eflags, debug-location !15
@@ -168,9 +191,10 @@ body: |
bb.1.if.then:
successors: %bb.3(0x80000000)
- liveins: $ebp, $rbx
+ liveins: $ebp, $rbx, $r13
$edi = COPY renamable $ebx, debug-location !15
+ $r8d = COPY renamable $r13d, debug-location !15
CALL64pcrel32 @externFunc, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !15
renamable $eax = KILL $eax, implicit-def $rax, debug-location !15
renamable $eax = nsw ADD32rm renamable $eax, $rsp, 1, $noreg, 12, $noreg, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax, debug-location !15 :: (dereferenceable load (s32) from %ir.local1, !tbaa !20)
@@ -178,26 +202,32 @@ body: |
bb.2.if.else:
successors: %bb.3(0x80000000)
- liveins: $ebp, $rbx
+ liveins: $ebp, $r13, $rbx
$edi = COPY renamable $ebx, debug-location !15
+ $r8d = COPY renamable $r13d, debug-location !15
CALL64pcrel32 @externFunc2, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !15
renamable $eax = KILL $eax, implicit-def $rax, debug-location !15
renamable $eax = nsw ADD32rm renamable $eax, $rsp, 1, $noreg, 12, $noreg, implicit-def dead $eflags, implicit killed $rax, implicit-def $rax, debug-location !15 :: (dereferenceable load (s32) from %ir.local1, !tbaa !20)
bb.3.if.end:
- liveins: $ebp, $rax, $rbx, $r12
+ liveins: $ebp, $rax, $rbx, $r13, $r12, $r10
; Instruction below is added in order to test moving variable's value from one register to another.
$r12d = MOV32rr killed $ebx, implicit-def $r12
+ $r10d = MOV32rr killed $r13d, implicit-def $r10
renamable $eax = nsw LEA64_32r killed renamable $rax, 4, killed renamable $rbx, 0, $noreg, debug-location !15
renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $ebp, implicit-def dead $eflags, debug-location !15
$rsp = frame-destroy ADD64ri8 $rsp, 16, implicit-def dead $eflags, debug-location !15
- CFI_INSTRUCTION def_cfa_offset 32, debug-location !15
+ CFI_INSTRUCTION def_cfa_offset 48, debug-location !15
$rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !15
- CFI_INSTRUCTION def_cfa_offset 24, debug-location !15
+ CFI_INSTRUCTION def_cfa_offset 40, debug-location !15
$r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !15
- CFI_INSTRUCTION def_cfa_offset 16, debug-location !15
+ CFI_INSTRUCTION def_cfa_offset 32, debug-location !15
$rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !15
+ CFI_INSTRUCTION def_cfa_offset 24, debug-location !15
+ $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !15
+ CFI_INSTRUCTION def_cfa_offset 16, debug-location !15
+ $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !15
CFI_INSTRUCTION def_cfa_offset 8, debug-location !15
RET 0, $eax, debug-location !15
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
index ec99617165061..504735dcdf900 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir
@@ -9,6 +9,7 @@
# 'h': complex expressions should be restored
# 'i': spills should be restored across block boundaries
# 'j': indirect DBG_VALUEs should be indirect after restoration
+# 'k': variadic debug values should be restored
# #define FORCE_SPILL() \
# __asm volatile("" : : : \
@@ -27,6 +28,7 @@
# CHECK: ![[RVAR:[0-9]+]] = !DILocalVariable(name: "r",
# CHECK: ![[SVAR:[0-9]+]] = !DILocalVariable(name: "s",
# CHECK: ![[TVAR:[0-9]+]] = !DILocalVariable(name: "t",
+# CHECK: ![[UVAR:[0-9]+]] = !DILocalVariable(name: "u",
# Ascertain that the spill has been recognized and manifested in a DBG_VALUE.
# CHECK: MOV64mr $rsp,{{.*-8.*}}killed{{.*}}$rdi :: (store (s64) into %stack.0)
@@ -124,6 +126,22 @@
%0 = load i32, i32* %add.ptr, align 4, !dbg !414, !tbaa !24
ret i32 %0, !dbg !415
}
+
+ define dso_local i32 @k(i32* readonly %p) local_unnamed_addr !dbg !507 {
+ entry:
+ call void @llvm.dbg.value(metadata i32* %p, metadata !513, metadata !DIExpression()), !dbg !514
+ %tobool = icmp eq i32* %p, null, !dbg !515
+ br i1 %tobool, label %if.end, label %if.then, !dbg !517
+
+ if.then: ; preds = %entry
+ tail call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(), !dbg !518, !srcloc !520
+ br label %if.end, !dbg !521
+
+ if.end: ; preds = %entry, %if.then
+ %add.ptr = getelementptr inbounds i32, i32* %p, i64 1, !dbg !522
+ %0 = load i32, i32* %add.ptr, align 4, !dbg !523, !tbaa !24
+ ret i32 %0, !dbg !528
+ }
declare void @llvm.dbg.value(metadata, metadata, metadata)
@@ -160,6 +178,7 @@
!26 = !{!"omnipotent char", !27, i64 0}
!27 = !{!"Simple C/C++ TBAA"}
!28 = !DILocation(line: 9, column: 3, scope: !7)
+ !29 = !DILocalVariable(name: "p0", scope: !7, file: !1, line: 5, type: !11)
!101 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
!107 = distinct !DISubprogram(name: "g", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !112)
!112 = !{!113}
@@ -220,6 +239,22 @@
!413 = !DILocation(line: 109, column: 14, scope: !402)
!414 = !DILocation(line: 109, column: 10, scope: !402)
!415 = !DILocation(line: 109, column: 3, scope: !402)
+ !501 = !DIBasicType(name: "looong int", size: 64, encoding: DW_ATE_signed)
+ !507 = distinct !DISubprogram(name: "k", scope: !0, file: !1, line: 105, type: !8, scopeLine: 105, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !512)
+ !512 = !{!513}
+ !513 = !DILocalVariable(name: "u", arg: 1, scope: !507, file: !1, line: 105, type: !501)
+ !514 = !DILocation(line: 105, column: 12, scope: !507)
+ !515 = !DILocation(line: 106, column: 7, scope: !516)
+ !516 = distinct !DILexicalBlock(scope: !507, file: !1, line: 106, column: 7)
+ !517 = !DILocation(line: 106, column: 7, scope: !507)
+ !518 = !DILocation(line: 107, column: 5, scope: !519)
+ !519 = distinct !DILexicalBlock(scope: !516, file: !1, line: 106, column: 10)
+ !520 = !{i32 -2147471544}
+ !521 = !DILocation(line: 108, column: 3, scope: !519)
+ !522 = !DILocation(line: 109, column: 14, scope: !507)
+ !523 = !DILocation(line: 109, column: 10, scope: !507)
+ !528 = !DILocation(line: 109, column: 3, scope: !507)
+
...
---
name: f
@@ -743,4 +778,123 @@ body: |
renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !414 :: (load (s32) from %ir.add.ptr, !tbaa !24)
RET64 $eax, debug-location !415
+...
+---
+# Test that if the values used by a variable with a variadic debug value are
+# spilt and restored, we correctly track each value individually.
+# This third function tests that complex expressions are spilt, and restored
+# correctly within a basic block.
+
+# CHECK-LABEL: name: k
+# CHECK-LABEL: bb.0.entry:
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $r10
+# CHECK-LABEL: bb.1.if.then:
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $r10
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rsp, $r10
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_constu, 16, DW_OP_minus, DW_OP_deref, DW_OP_plus), $rsp, $rsp
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_constu, 16, DW_OP_minus, DW_OP_deref, DW_OP_plus), $rdi, $rsp
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $r10
+# CHECK-LABEL: bb.2.if.end:
+# CHECK: DBG_VALUE_LIST ![[UVAR]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $r10
+
+name: k
+alignment: 16
+tracksRegLiveness: true
+liveins:
+ - { reg: '$rdi', virtual-reg: '' }
+ - { reg: '$r10', virtual-reg: '' }
+frameInfo:
+ stackSize: 48
+ offsetAdjustment: -48
+ maxAlignment: 8
+ cvBytesOfCalleeSavedRegisters: 48
+ localFrameSize: 0
+fixedStack:
+ - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, stack-id: default,
+ callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+ - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, stack-id: default,
+ callee-saved-register: '$r12', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+ - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, stack-id: default,
+ callee-saved-register: '$r13', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+ - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
+ callee-saved-register: '$r14', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+ - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,
+ callee-saved-register: '$r15', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+ - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
+ callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
+stack:
+ - { id: 0, name: '', type: spill-slot, offset: -64, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+ - { id: 1, name: '', type: spill-slot, offset: -72, size: 8, alignment: 8,
+ stack-id: default, callee-saved-register: '', callee-saved-restored: true,
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
+constants: []
+body: |
+ bb.0.entry:
+ successors: %bb.2(0x30000000), %bb.1(0x50000000)
+ liveins: $rdi, $r10, $rbx, $r12, $r13, $r14, $r15, $rbp
+
+ DBG_VALUE_LIST !513, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 1, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $r10, debug-location !514
+ TEST64rr renamable $rdi, renamable $rdi, implicit-def $eflags, debug-location !515
+ JCC_1 %bb.2, 4, implicit $eflags, debug-location !517
+
+ bb.1.if.then:
+ successors: %bb.2(0x80000000)
+ liveins: $rdi, $r10, $rbp, $r15, $r14, $r13, $r12, $rbx
+
+ frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 16
+ frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 24
+ frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 32
+ frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 40
+ frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 48
+ frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 56
+ CFI_INSTRUCTION offset $rbx, -56
+ CFI_INSTRUCTION offset $r12, -48
+ CFI_INSTRUCTION offset $r13, -40
+ CFI_INSTRUCTION offset $r14, -32
+ CFI_INSTRUCTION offset $r15, -24
+ CFI_INSTRUCTION offset $rbp, -16
+ MOV64mr $rsp, 1, $noreg, -8, $noreg, killed renamable $rdi :: (store (s64) into %stack.0)
+ MOV64mr $rsp, 1, $noreg, -16, $noreg, killed renamable $r10 :: (store (s64) into %stack.1)
+ INLINEASM &"", 1, 12, implicit-def dead early-clobber $rax, 12, implicit-def dead early-clobber $rbx, 12, implicit-def dead early-clobber $rcx, 12, implicit-def dead early-clobber $rdx, 12, implicit-def dead early-clobber $rsi, 12, implicit-def dead early-clobber $rdi, 12, implicit-def dead early-clobber $rbp, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $eflags, !520, debug-location !518
+ renamable $rdi = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load (s64) from %stack.0)
+ renamable $r10 = MOV64rm $rsp, 1, $noreg, -16, $noreg :: (load (s64) from %stack.1)
+ ; Clobber stack location to force variable location to move to $rdi.
+ $rax = MOV64ri 0
+ MOV64mr $rsp, 1, _, -8, _, renamable $rax :: (store (s64) into %stack.0)
+ MOV64mr $rsp, 1, _, -16, _, killed renamable $rax :: (store (s64) into %stack.1)
+ $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 48
+ $r12 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 40
+ $r13 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 32
+ $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 24
+ $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 16
+ $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp
+ CFI_INSTRUCTION def_cfa_offset 8
+
+ bb.2.if.end:
+ liveins: $rdi, $rbx, $r12, $r13, $r14, $r15, $rbp
+
+ renamable $eax = MOV32rm killed renamable $rdi, 1, $noreg, 4, $noreg, debug-location !523 :: (load (s32) from %ir.add.ptr, !tbaa !24)
+ RET64 $eax, debug-location !528
+
+
+
...
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values-stack-clobber.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values-stack-clobber.mir
index 2f5f8b829d66a..91892102fc5ee 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values-stack-clobber.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values-stack-clobber.mir
@@ -32,12 +32,17 @@
#
# CHECK: ![[ANUM:[0-9]+]] = !DILocalVariable(name: "a"
# CHECK: ![[BNUM:[0-9]+]] = !DILocalVariable(name: "b"
+# CHECK: ![[CNUM:[0-9]+]] = !DILocalVariable(name: "c"
#
# These variables should be spilt,
# CHECK-LABEL: bb.1.if.end:
# CHECK: MOV64mr $rsp, 1, $noreg, 16, $noreg, killed renamable $rsi
+# CHECK-NEXT: DBG_VALUE_LIST ![[CNUM]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_plus_uconst, 16, DW_OP_deref
+# CHECK-SAME: $rsp, $rdi
# CHECK-NEXT: DBG_VALUE $rsp, 0, ![[BNUM]], !DIExpression(
# CHECK-NEXT: MOV64mr $rsp, 1, $noreg, 8, $noreg, killed renamable $rdi
+# CHECK-NEXT: DBG_VALUE_LIST ![[CNUM]], !DIExpression({{[^)]+}}DW_OP_LLVM_arg, 1, DW_OP_plus_uconst, 8, DW_OP_deref
+# CHECK-SAME: $rsp, $rsp
# CHECK-NEXT: DBG_VALUE $rsp, 0, ![[ANUM]], !DIExpression(
# CHECK-NEXT: INLINEASM
#
@@ -45,6 +50,7 @@
# CHECK-LABEL: bb.3.if.end3:
# CHECK: CALL64pcrel32 @sum
# CHECK-NEXT: MOV64mr $rsp, 1, $noreg, 8, $noreg, $rax
+# CHECK-NEXT: DBG_VALUE_LIST ![[CNUM]], !DIExpression({{[^)]*}}), $noreg, $noreg
# CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[ANUM]], !DIExpression()
# CHECK-NEXT: INLINEASM
@@ -92,7 +98,7 @@
!16 = !{!17, !18, !19}
!17 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !3, line: 15, type: !15)
!18 = !DILocalVariable(name: "b", arg: 2, scope: !12, file: !3, line: 15, type: !15)
- !19 = !DILocalVariable(name: "quux", scope: !12, file: !3, line: 23, type: !7)
+ !19 = !DILocalVariable(name: "c", scope: !12, file: !3, line: 23, type: !7)
!28 = !DILocation(line: 1, column: 1, scope: !12)
...
@@ -144,6 +150,7 @@ body: |
DBG_VALUE $rdi, $noreg, !17, !DIExpression(), debug-location !28
DBG_VALUE $rsi, $noreg, !18, !DIExpression(), debug-location !28
DBG_VALUE $rsi, $noreg, !18, !DIExpression(), debug-location !28
+ DBG_VALUE_LIST !19, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rsi, $rdi, debug-location !28
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp, debug-location !28
frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp, debug-location !28
frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp, debug-location !28
More information about the llvm-commits
mailing list