[llvm] f911c39 - [DebugInfo] Adjust x86 location-list tests for instruction referencing
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 04:31:03 PST 2021
Author: Jeremy Morse
Date: 2021-11-24T12:30:55Z
New Revision: f911c397dc9ee5849dff265b872b8df7458bf1e0
URL: https://github.com/llvm/llvm-project/commit/f911c397dc9ee5849dff265b872b8df7458bf1e0
DIFF: https://github.com/llvm/llvm-project/commit/f911c397dc9ee5849dff265b872b8df7458bf1e0.diff
LOG: [DebugInfo] Adjust x86 location-list tests for instruction referencing
This patch updates location lists in various x86 tests to reflect what
instruction referencing produces. There are two flavours of change:
* Not following a register copy immediately, because instruction
referencing can make some slightly smarter decisions,
* Extended ranges, due to having additional information.
The register changes aren't that interesting, it's just a choice between
equally legitimate registers that instr-ref does differently. The extended
ranges are largely due to following stack restores better.
Differential Revision: https://reviews.llvm.org/D114362
Added:
Modified:
llvm/test/DebugInfo/COFF/pieces.ll
llvm/test/DebugInfo/COFF/register-variables.ll
llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-4.ll
llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-5.ll
llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll
llvm/test/DebugInfo/X86/pieces-3.ll
llvm/test/DebugInfo/X86/sdag-combine.ll
llvm/test/DebugInfo/X86/spill-nospill.ll
Removed:
################################################################################
diff --git a/llvm/test/DebugInfo/COFF/pieces.ll b/llvm/test/DebugInfo/COFF/pieces.ll
index 132789b77b382..01dffde30e52b 100644
--- a/llvm/test/DebugInfo/COFF/pieces.ll
+++ b/llvm/test/DebugInfo/COFF/pieces.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck %s --check-prefix=ASM
-; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=false | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
+; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s --check-prefix=ASM
+; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=true | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
; Compile with -O1 as C
@@ -83,7 +83,7 @@
; ASM: .cv_loc 2 1 24 3 # t.c:24:3
; ASM: movq %rcx, %rax
; ASM: [[pad_left_tmp:\.Ltmp[0-9]+]]:
-; ASM: #DEBUG_VALUE: pad_left:o <- [DW_OP_LLVM_fragment 0 32] $eax
+; ASM: #DEBUG_VALUE: pad_left:o <- [DW_OP_LLVM_fragment 0 32] $ecx
; ASM: retq
; ASM: [[pad_left_end:\.Lfunc_end2]]:
@@ -105,8 +105,10 @@
; ASM: #APP
; ASM: #NO_APP
; ASM: movl [[offset_o_x]](%rsp), %eax # 4-byte Reload
+; ASM: [[spill_o_x_end:\.Ltmp[0-9]+]]:
+; ASM: #DEBUG_VALUE: bitpiece_spill:o <- [DW_OP_LLVM_fragment 32 32] $eax
; ASM: retq
-; ASM-NEXT: [[spill_o_x_end:\.Ltmp[0-9]+]]:
+; ASM: [[spill_o_x_end_func:\.Ltmp[0-9]+]]:
; ASM-NEXT: .Lfunc_end4:
@@ -171,7 +173,7 @@
; ASM: .asciz "pad_left" # Function name
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .asciz "o"
-; ASM: .cv_def_range [[pad_left_tmp]] [[pad_left_end]], subfield_reg, 17, 0
+; ASM: .cv_def_range [[pad_left_tmp]] [[pad_left_end]], subfield_reg, 18, 0
; OBJ-LABEL: GlobalProcIdSym {
; OBJ: Kind: S_GPROC32_ID (0x1147)
@@ -181,7 +183,7 @@
; OBJ: VarName: o
; OBJ: }
; OBJ: DefRangeSubfieldRegisterSym {
-; OBJ: Register: EAX (0x11)
+; OBJ: Register: ECX (0x12)
; OBJ: MayHaveNoName: 0
; OBJ: OffsetInParent: 0
; OBJ: LocalVariableAddrRange {
@@ -233,7 +235,8 @@
; ASM: .asciz "bitpiece_spill" # Function name
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .asciz "o"
-; ASM: .cv_def_range [[spill_o_x_start]] .Lfunc_end4, reg_rel, 335, 65, 36
+; ASM: .cv_def_range [[spill_o_x_start]] [[spill_o_x_end]], reg_rel, 335, 65, 36
+; ASM: .cv_def_range [[spill_o_x_end]] .Lfunc_end4, subfield_reg, 17, 4
; OBJ-LABEL: GlobalProcIdSym {
; OBJ: Kind: S_GPROC32_ID (0x1147)
diff --git a/llvm/test/DebugInfo/COFF/register-variables.ll b/llvm/test/DebugInfo/COFF/register-variables.ll
index 1f8609dde631a..62f5f5ef05844 100644
--- a/llvm/test/DebugInfo/COFF/register-variables.ll
+++ b/llvm/test/DebugInfo/COFF/register-variables.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck %s --check-prefix=ASM
-; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=false | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
+; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s --check-prefix=ASM
+; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=true | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
; Generated from:
; volatile int x;
@@ -29,7 +29,6 @@
; ASM: subq $32, %rsp
; ASM: movl %ecx, %esi
; ASM: [[p_ecx_esi:\.Ltmp.*]]:
-; ASM: #DEBUG_VALUE: f:p <- $esi
; ASM: callq getint
; ASM: [[after_getint:\.Ltmp.*]]:
; ASM: testl %esi, %esi
@@ -46,7 +45,9 @@
; ASM: [[after_if:\.Ltmp.*]]:
; ASM: .LBB0_2: # %if.else
; ASM: #DEBUG_VALUE: f:p <- $esi
-; ASM: #DEBUG_VALUE: c <- $eax
+;; FIXME: tail-merging causes the location of "c" to be dropped in instruction
+;; referencing mode.
+; ASM: #DEBUG_VALUE: c <- undef
; ASM: movl %eax, %ecx
; ASM: addq $32, %rsp
; ASM: popq %rsi
@@ -56,8 +57,8 @@
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .asciz "p"
-; ASM: .cv_def_range .Lfunc_begin0 [[p_ecx_esi]], reg, 18
-; ASM: .cv_def_range [[p_ecx_esi]] [[func_end]], reg, 23
+; ASM: .cv_def_range .Lfunc_begin0 [[after_getint]], reg, 18
+; ASM: .cv_def_range [[after_getint]] [[func_end]], reg, 23
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .asciz "c"
; ASM: .short 4414 # Record kind: S_LOCAL
@@ -94,15 +95,15 @@
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0x0
; OBJ: ISectStart: 0x0
-; OBJ: Range: 0x7
+; OBJ: Range: 0xC
; OBJ: }
; OBJ: }
; OBJ: DefRangeRegisterSym {
; OBJ: Register: ESI (0x17)
; OBJ: LocalVariableAddrRange {
-; OBJ: OffsetStart: .text+0x7
+; OBJ: OffsetStart: .text+0xC
; OBJ: ISectStart: 0x0
-; OBJ: Range: 0x1A
+; OBJ: Range: 0x15
; OBJ: }
; OBJ: }
; OBJ: LocalSym {
diff --git a/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-4.ll b/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-4.ll
index 25a54ee277c5a..1328a09be8dbc 100644
--- a/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-4.ll
+++ b/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-4.ll
@@ -1,11 +1,12 @@
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location
-; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value)
+; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value
+; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_reg0 RAX)
; CHECK-NEXT: DW_AT_name ("i")
; Source to generate the IR below:
diff --git a/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-5.ll b/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-5.ll
index 6d23ac8b350cf..a32bfb7f85509 100644
--- a/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-5.ll
+++ b/llvm/test/DebugInfo/X86/basic-block-sections-debug-loclist-5.ll
@@ -1,13 +1,14 @@
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location
; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value
; SECTIONS-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value
; SECTIONS-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value
+; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_reg0 RAX)
; CHECK-NEXT: DW_AT_name ("i")
; In the test below, i's constant value of 7 is only valid partially as
diff --git a/llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll b/llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll
index 5b751d0498ca7..fc48b21b8da9c 100644
--- a/llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll
+++ b/llvm/test/DebugInfo/X86/live-debug-values-remove-range.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-unknown-unknown %s -o - -stop-after=livedebugvalues -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -mtriple=x86_64-unknown-unknown %s -o - -stop-after=livedebugvalues -experimental-debug-variable-locations=true | FileCheck %s
;
; In the simple loop below, the location of the variable "toast" is %bar in
; the entry block, then set to constant zero at the end of the loop. We cannot
@@ -35,12 +35,11 @@
; before the loop, and its position re-stated in each block.
; CHECK-LABEL: name: quux
; CHECK: DBG_VALUE $edi, $noreg, ![[QUUXVARNUM]]
-; CHECK: DBG_VALUE [[QUUXLOC:[a-zA-Z0-9$_]+]], $noreg, ![[QUUXVARNUM]]
; CHECK-LABEL: bb.1.loop
-; CHECK: DBG_VALUE [[QUUXLOC]], $noreg, ![[QUUXVARNUM]]
+; CHECK: DBG_VALUE $ebx, $noreg, ![[QUUXVARNUM]]
; CHECK-NOT: DBG_VALUE $noreg
; CHECK-LABEL: bb.2.exit
-; CHECK: DBG_VALUE [[QUUXLOC]], $noreg, ![[QUUXVARNUM]]
+; CHECK: DBG_VALUE $ebx, $noreg, ![[QUUXVARNUM]]
; CHECK-NOT: DBG_VALUE $noreg
declare dso_local i1 @booler()
diff --git a/llvm/test/DebugInfo/X86/pieces-3.ll b/llvm/test/DebugInfo/X86/pieces-3.ll
index 1f1704db4a0eb..5a800ff508126 100644
--- a/llvm/test/DebugInfo/X86/pieces-3.ll
+++ b/llvm/test/DebugInfo/X86/pieces-3.ll
@@ -1,4 +1,4 @@
-; RUN: llc %s -filetype=obj -o - -experimental-debug-variable-locations=false | llvm-dwarfdump -v - | FileCheck %s
+; RUN: llc %s -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump -v - | FileCheck %s
;
; // Compile with -O1
; typedef struct {
@@ -17,12 +17,11 @@
;
; CHECK: DW_TAG_formal_parameter [3]
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
-; CHECK-NEXT: [0x0000000000000000, 0x0000000000000007): DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4
-; CHECK-NEXT: [0x0000000000000007, 0x0000000000000009): DW_OP_reg5 RDI, DW_OP_piece 0x8
+; CHECK-NEXT: [0x0000000000000000, 0x0000000000000009): DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4
; CHECK-NEXT: DW_AT_name {{.*}}"outer"
; CHECK: DW_TAG_variable
-; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x00000044
-; CHECK-NEXT: [0x0000000000000007, 0x0000000000000009): DW_OP_reg0 RAX, DW_OP_piece 0x4)
+; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x0000002a
+; CHECK-NEXT: [0x0000000000000007, 0x0000000000000009): DW_OP_reg4 RSI, DW_OP_piece 0x4)
; CHECK-NEXT: "i1"
; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-2.ll'
diff --git a/llvm/test/DebugInfo/X86/sdag-combine.ll b/llvm/test/DebugInfo/X86/sdag-combine.ll
index c6bdd1a9954b6..eb37609967223 100644
--- a/llvm/test/DebugInfo/X86/sdag-combine.ll
+++ b/llvm/test/DebugInfo/X86/sdag-combine.ll
@@ -1,4 +1,5 @@
-; RUN: llc %s -stop-after=livedebugvars -o - -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc %s -stop-after=livedebugvars -o - -experimental-debug-variable-locations=false | FileCheck %s --check-prefix=CHECK
+; RUN: llc %s -stop-after=livedebugvars -o - -experimental-debug-variable-locations=true | FileCheck %s --check-prefix=INSTRREF
source_filename = "/tmp/t.ll"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.13"
@@ -15,7 +16,8 @@ define swiftcc void @g() #0 !dbg !5 {
entry:
%0 = alloca %TSb, align 1
%1 = call swiftcc i1 @f(), !dbg !7
- ; CHECK: DBG_VALUE $rcx, $noreg, !8, !DIExpression(), debug-location !7
+ ; CHECK: DBG_VALUE $rcx, $noreg, !8, !DIExpression(),
+ ; INSTRREF: DBG_VALUE $ecx, $noreg, !8, !DIExpression(),
call void @llvm.dbg.value(metadata i1 %1, metadata !8, metadata !DIExpression()), !dbg !7
%2 = getelementptr inbounds %TSb, %TSb* %0, i32 0, i32 0, !dbg !7
store i1 %1, i1* %2, align 1, !dbg !7
diff --git a/llvm/test/DebugInfo/X86/spill-nospill.ll b/llvm/test/DebugInfo/X86/spill-nospill.ll
index eec2b5c56a77d..c8a680067fb53 100644
--- a/llvm/test/DebugInfo/X86/spill-nospill.ll
+++ b/llvm/test/DebugInfo/X86/spill-nospill.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck %s
-; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=false | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
+; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s
+; RUN: llc < %s -filetype=obj -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
; This test creates two UserValues in LiveDebugVariables with one location
; each. x must be spilled, but y will be allocated to a CSR. x's location
@@ -43,7 +43,8 @@
; DWARF: DW_TAG_variable
; DWARF-NEXT: DW_AT_location (
; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+36
-; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_reg0 RAX)
+; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_reg0 RAX
+; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+36)
; DWARF-NEXT: DW_AT_name ("x")
; DWARF: DW_TAG_variable
More information about the llvm-commits
mailing list