[llvm] 32815bc - [DebugInfo][InstrRef][NFC] Test changes: DBG_VALUE to DBG_INSTR_REF
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 13:13:35 PST 2021
Author: Jeremy Morse
Date: 2021-11-29T20:53:48Z
New Revision: 32815bc907c4bf25866545da93b00b5d6c2ce45f
URL: https://github.com/llvm/llvm-project/commit/32815bc907c4bf25866545da93b00b5d6c2ce45f
DIFF: https://github.com/llvm/llvm-project/commit/32815bc907c4bf25866545da93b00b5d6c2ce45f.diff
LOG: [DebugInfo][InstrRef][NFC] Test changes: DBG_VALUE to DBG_INSTR_REF
This patch contains a bunch of replacements of:
DBG_VALUE $somereg
with,
SOMEINST debug-instr-number1
DBG_INSTR_REF 1, 0, ...
It's mostly SelectionDAG tests that are making sure that the variable
location assignment is placed in the correct position in the instructions.
To avoid a loss in test coverage of SelectionDAG, which is used by a lot
of different backends, all these tests now have two modes and sets of RUN
lines, one for DBG_VALUE mode, the other for instruction referencing.
Differential Revision: https://reviews.llvm.org/D114258
Added:
Modified:
llvm/test/DebugInfo/X86/pr34545.ll
llvm/test/DebugInfo/X86/pr40427.ll
llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll
llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll
llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll
llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll
llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll
llvm/test/DebugInfo/X86/sdag-dbgvalue-ssareg.ll
llvm/test/DebugInfo/X86/sdag-ir-salvage.ll
llvm/test/DebugInfo/X86/sdag-salvage-add.ll
llvm/test/DebugInfo/X86/sdag-transfer-dbgvalue.ll
Removed:
################################################################################
diff --git a/llvm/test/DebugInfo/X86/pr34545.ll b/llvm/test/DebugInfo/X86/pr34545.ll
index 047a948cecdda..2f50362d7ad8a 100644
--- a/llvm/test/DebugInfo/X86/pr34545.ll
+++ b/llvm/test/DebugInfo/X86/pr34545.ll
@@ -1,14 +1,27 @@
-; RUN: llc -O1 -filetype=asm -mtriple x86_64-unknown-linux-gnu -mcpu=x86-64 -o - %s -stop-after=livedebugvars -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -O1 -filetype=asm -mtriple x86_64-unknown-linux-gnu -mcpu=x86-64 \
+; RUN: -o - %s -stop-after=livedebugvars \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK
+; RUN: llc -O1 -filetype=asm -mtriple x86_64-unknown-linux-gnu -mcpu=x86-64 \
+; RUN: -o - %s -stop-after=livedebugvars \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
-; CHECK: $eax = MOV32rm
-; CHECK: DBG_VALUE $eax
-; CHECK: $eax = SHL32rCL killed renamable $eax
-; CHECK: DBG_VALUE $eax
-; CHECK: DBG_VALUE $rsp, 0, !{{[0-9]+}}, !DIExpression(DW_OP_constu, 4, DW_OP_minus)
-; CHECK: DBG_VALUE $eax
-; CHECK: $eax = SHL32rCL killed renamable $eax
-; CHECK: DBG_VALUE $eax
-; CHECK: RET64 $eax
+; CHECK: $eax = MOV32rm
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF: DBG_INSTR_REF 1, 0
+; CHECK: DBG_VALUE $eax
+; CHECK: $eax = SHL32rCL killed renamable $eax,
+; INSTRREF-SAME: debug-instr-number 2
+; INSTRREF: DBG_INSTR_REF 2, 0
+; CHECK: DBG_VALUE $eax
+; CHECK: DBG_VALUE $rsp, 0, !{{[0-9]+}}, !DIExpression(DW_OP_constu, 4, DW_OP_minus)
+; CHECK: DBG_VALUE $eax
+; CHECK: $eax = SHL32rCL killed renamable $eax,
+; INSTRREF-SAME: debug-instr-number 3
+; INSTRREF: DBG_INSTR_REF 3, 0
+; CHECK: DBG_VALUE $eax
+; CHECK: RET64 $eax
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -28,7 +41,7 @@ entry:
%shl2 = shl i32 %shl, %2
tail call void @llvm.dbg.value(metadata i32 %shl2, metadata !18, metadata !DIExpression()), !dbg !20
store i32 %shl2, i32* @var
- ret i32 %shl2
+ ret i32 %shl2, !dbg !20
}
declare void @llvm.dbg.value(metadata, metadata, metadata)
diff --git a/llvm/test/DebugInfo/X86/pr40427.ll b/llvm/test/DebugInfo/X86/pr40427.ll
index a3040f9a8dba3..2848b892f1ce6 100644
--- a/llvm/test/DebugInfo/X86/pr40427.ll
+++ b/llvm/test/DebugInfo/X86/pr40427.ll
@@ -1,11 +1,18 @@
-; RUN: llc -start-after=codegenprepare -stop-before=finalize-isel -o - < %s -experimental-debug-variable-locations=false | FileCheck %s
-; Test for correct placement of DBG_VALUE, which in PR40427 is placed before
-; the load instruction it refers to. The circumstance replicated here is where
-; two instructions in a row, trunc and add, begin with no-op Copy{To,From}Reg
-; SDNodes that produce no instructions.
-; The DBG_VALUE instruction should come immediately after the load instruction
-; because the truncate is optimised out, and the DBG_VALUE should be placed
-; in front of the first instruction that occurs after the dbg.value.
+; RUN: llc -start-after=codegenprepare -stop-before=finalize-isel -o - < %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before=finalize-isel -o - < %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
+;
+;; Test for correct placement of DBG_VALUE, which in PR40427 is placed before
+;; the load instruction it refers to. The circumstance replicated here is where
+;; two instructions in a row, trunc and add, begin with no-op Copy{To,From}Reg
+;; SDNodes that produce no instructions.
+;; The DBG_VALUE instruction should come immediately after the load instruction
+;; because the truncate is optimised out, and the DBG_VALUE should be placed
+;; in front of the first instruction that occurs after the dbg.value.
+;
; CHECK: ![[DBGVAR:[0-9]+]] = !DILocalVariable(name: "bees",
@@ -20,8 +27,10 @@ falseb:
br label %block
block:
; CHECK: [[PHIREG:%[0-9]+]]:gr64 = PHI %6, %bb.2, %4, %bb.1
-; CHECK-NEXT: [[LOADR:%[0-9]+]]:gr16 = MOV16rm %0
-; CHECK-NEXT: DBG_VALUE [[LOADR]], $noreg, ![[DBGVAR]]
+; CHECK-NEXT: [[LOADR:%[0-9]+]]:gr16 = MOV16rm %0,
+; INSTRREF-SAME: debug-instr-number 1
+; DBGVALUE-NEXT: DBG_VALUE [[LOADR]], $noreg, ![[DBGVAR]]
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[DBGVAR]]
; CHECK-NEXT: %{{[0-9]+}}:gr32 = IMPLICIT_DEF
%foo = phi i64 *[%bees, %trueb], [%more, %falseb]
%forks = bitcast i64 *%foo to i32 *
diff --git a/llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll b/llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll
index 56b79a117986d..f2645c7019c61 100644
--- a/llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll
@@ -1,4 +1,9 @@
-; RUN: llc %s -stop-before finalize-isel -o - -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc %s -stop-before finalize-isel -o - \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc %s -stop-before finalize-isel -o - \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
;--------------------------------------------------------------------
; This test case is basically generated from the following C code.
@@ -66,8 +71,10 @@ target triple = "x86_64-apple-macosx10.4.0"
define i32 @test1() local_unnamed_addr #0 !dbg !17 {
; CHECK-LABEL: bb.0.entry1
; CHECK-NEXT: DBG_VALUE 0, $noreg, ![[BAR1]], !DIExpression()
-; CHECK-NEXT: [[REG1:%[0-9]+]]:gr64 =
-; CHECK-NEXT: DBG_VALUE [[REG1]], $noreg, ![[FOO1]], !DIExpression()
+; CHECK-NEXT: [[REG1:%[0-9]+]]:gr64 = LEA64r
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[FOO1]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, ![[FOO1]], !DIExpression()
entry1:
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !20, metadata !DIExpression()), !dbg !23
call void @llvm.dbg.value(metadata %struct.SS* null, metadata !22, metadata !DIExpression()), !dbg !24
@@ -77,9 +84,12 @@ entry1:
; Verify that the def comes before the for foo2 and bar2.
define i32 @test2() local_unnamed_addr #0 !dbg !26 {
; CHECK-LABEL: bb.0.entry2
-; CHECK-NEXT: [[REG2:%[0-9]+]]:gr64 =
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, ![[FOO2]], !DIExpression()
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, ![[BAR2]], !DIExpression()
+; CHECK-NEXT: [[REG2:%[0-9]+]]:gr64 = LEA64r
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[FOO2]], !DIExpression()
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[BAR2]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, ![[FOO2]], !DIExpression
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, ![[BAR2]], !DIExpression
entry2:
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !28, metadata !DIExpression()), !dbg !30
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !29, metadata !DIExpression()), !dbg !31
@@ -89,9 +99,12 @@ entry2:
; Verify that the def comes before the for foo3 and bar3.
define i32 @test3() local_unnamed_addr #0 !dbg !33 {
; CHECK-LABEL: bb.0.entry3
-; CHECK-NEXT: [[REG3:%[0-9]+]]:gr64 =
-; CHECK-NEXT: DBG_VALUE [[REG3]], $noreg, ![[BAR3]], !DIExpression()
-; CHECK-NEXT: DBG_VALUE [[REG3]], $noreg, ![[FOO3]], !DIExpression()
+; CHECK-NEXT: [[REG3:%[0-9]+]]:gr64 = LEA64r
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[BAR3]], !DIExpression()
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[FOO3]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, ![[BAR3]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, ![[FOO3]], !DIExpression()
entry3:
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !36, metadata !DIExpression()), !dbg !38
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !35, metadata !DIExpression()), !dbg !37
@@ -103,8 +116,10 @@ define i32 @test4() local_unnamed_addr #0 !dbg !40 {
; CHECK-LABEL: bb.0.entry4
; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[FOO4]], !DIExpression()
; CHECK-NEXT: DBG_VALUE 0, $noreg, ![[FOO4]], !DIExpression()
-; CHECK-NEXT: [[REG4:%[0-9]+]]:gr64 =
-; CHECK-NEXT: DBG_VALUE [[REG4]], $noreg, ![[BAR4]], !DIExpression()
+; CHECK-NEXT: [[REG4:%[0-9]+]]:gr64 = LEA64r
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[BAR4]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG4]], $noreg, ![[BAR4]], !DIExpression()
entry4:
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !42, metadata !DIExpression()), !dbg !44
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !43, metadata !DIExpression()), !dbg !45
@@ -117,9 +132,11 @@ define i32 @test5() local_unnamed_addr #0 !dbg !47 {
; CHECK-LABEL: bb.0.entry5:
; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[FOO5]], !DIExpression()
; CHECK-NEXT: DBG_VALUE 0, $noreg, ![[FOO5]], !DIExpression()
-; CHECK-NEXT: [[REG5:%[0-9]+]]:gr64 =
-; CHECK-NEXT: DBG_VALUE [[REG5]], $noreg, ![[BAR5]], !DIExpression()
-; CHECK-NOT: DBG_VALUE [[REG5]], $noreg, ![[FOO5]], !DIExpression()
+; CHECK-NEXT: [[REG5:%[0-9]+]]:gr64 = LEA64r
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, ![[BAR5]], !DIExpression()
+; DBGVALUE-NEXT: DBG_VALUE [[REG5]], $noreg, ![[BAR5]], !DIExpression()
+; CHECK-NOT: DBG_{{.*}} ![[FOO5]], !DIExpression()
; CHECK: RET
entry5:
call void @llvm.dbg.value(metadata %struct.SS* @S, metadata !49, metadata !DIExpression()), !dbg !51
diff --git a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll
index bd37a2f6dfcb4..6b8dbaffff8a9 100644
--- a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This test case was generated from the following debug.c program,
; using: clang debug.c -g -O1 -S -o dbg_value_phi_isel1.ll -emit-llvm
@@ -48,8 +53,10 @@ for.body.lr.ph: ; preds = %entry
for.cond.cleanup: ; preds = %for.body, %entry
; CHECK-LABEL: bb.{{.*}}.for.cond.cleanup:
-; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG1]]
+; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 7
+; INSTRREF-NEXT: DBG_INSTR_REF 7, 0
+; DBGVALUE-NEXT: DBG_VALUE [[REG1]]
%x.0.lcssa = phi i32 [ 9, %entry ], [ %add, %for.body ]
call void @llvm.dbg.value(metadata i32 %x.0.lcssa, metadata !15, metadata !DIExpression()), !dbg !26
%2 = bitcast [80 x i32]* %arr to i8*, !dbg !37
@@ -60,12 +67,18 @@ for.cond.cleanup: ; preds = %for.body, %entry
for.body: ; preds = %for.body.lr.ph, %for.body
; CHECK-LABEL: bb.{{.*}}.for.body:
-; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG2]]
-; CHECK-NEXT: DBG_VALUE [[REG3]]
-; CHECK-NEXT: DBG_VALUE [[REG4]]
+; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 3
+; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 4
+; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 5
+; INSTRREF-NEXT: DBG_INSTR_REF 3, 0
+; INSTRREF-NEXT: DBG_INSTR_REF 4, 0
+; INSTRREF-NEXT: DBG_INSTR_REF 5, 0
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]]
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]]
+; DBGVALUE-NEXT: DBG_VALUE [[REG4]]
%u.023 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%y.022 = phi i32 [ 13, %for.body.lr.ph ], [ %mul, %for.body ]
%x.021 = phi i32 [ 9, %for.body.lr.ph ], [ %add, %for.body ]
diff --git a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll
index 6ec2508dbefaa..9ca91e3dcb293 100644
--- a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This test case is a modified version of dbg_value_phi_isel1.ll
; where the llvm.dbg.value nodes in for.body has been moved.
@@ -27,8 +32,10 @@ for.body.lr.ph: ; preds = %entry
for.cond.cleanup: ; preds = %for.body, %entry
; CHECK-LABEL: bb.{{.*}}.for.cond.cleanup:
-; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG1]]
+; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 7
+; INSTRREF-NEXT: DBG_INSTR_REF 7, 0
+; DBGVALUE-NEXT: DBG_VALUE [[REG1]]
%x.0.lcssa = phi i32 [ 9, %entry ], [ %add, %for.body ]
call void @llvm.dbg.value(metadata i32 %x.0.lcssa, metadata !15, metadata !DIExpression()), !dbg !26
%2 = bitcast [80 x i32]* %arr to i8*, !dbg !37
@@ -39,22 +46,34 @@ for.cond.cleanup: ; preds = %for.body, %entry
for.body: ; preds = %for.body.lr.ph, %for.body
; CHECK-LABEL: bb.{{.*}}.for.body:
-; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG3]], $noreg, !16
-; CHECK-NEXT: DBG_VALUE 555, $noreg, !17
-; CHECK-NEXT: [[ADDREG:%[0-9]+]]:gr32 = nuw nsw ADD32rr
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, !17
-; CHECK: [[MULREG:%[0-9]+]]:gr32 = LEA64_32r
-; CHECK-NEXT: DBG_VALUE 777, $noreg, !17
-; XXX: The following DBG_VALUE should have stayed below the INC32r
-; CHECK-NEXT: DBG_VALUE [[MULREG]], $noreg, !16
-; CHECK-NEXT: [[INCREG:%[0-9]+]]:gr32 = nuw nsw INC32r
-; CHECK-NEXT: DBG_VALUE [[INCREG]], $noreg, !17
-; CHECK-NEXT: DBG_VALUE [[ADDREG]], $noreg, !15
-; CHECK-NEXT: implicit-def $eflags,
-; CHECK-NEXT: DBG_VALUE [[REG4]]
+; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 4
+; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 3
+; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 6
+; INSTRREF-NEXT: DBG_INSTR_REF 3, 0, !16
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, !16
+; CHECK-NEXT: DBG_VALUE 555, $noreg, !17
+; CHECK-NEXT: [[ADDREG:%[0-9]+]]:gr32 = nuw nsw ADD32rr
+; INSTRREF-SAME: debug-instr-number 5
+; INSTRREF-NEXT: DBG_INSTR_REF 4, 0, !17
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !17
+; CHECK: [[MULREG:%[0-9]+]]:gr32 = LEA64_32r
+; INSTRREF-SAME: debug-instr-number 1
+; CHECK-NEXT: DBG_VALUE 777, $noreg, !17
+;;; XXX: The following DBG_INSTR_REF should have stayed below the INC32r
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, !16
+; DBGVALUE-NEXT: DBG_VALUE [[MULREG]], $noreg, !16
+; CHECK-NEXT: [[INCREG:%[0-9]+]]:gr32 = nuw nsw INC32r
+; INSTRREF-SAME: debug-instr-number 2
+; INSTRREF-NEXT: DBG_INSTR_REF 2, 0, !17
+; INSTRREF-NEXT: DBG_INSTR_REF 5, 0, !15
+; DBGVALUE-NEXT: DBG_VALUE [[INCREG]], $noreg, !17
+; DBGVALUE-NEXT: DBG_VALUE [[ADDREG]], $noreg, !15
+; CHECK-NEXT: implicit-def $eflags,
+; INSTRREF-NEXT: DBG_INSTR_REF 6, 0
+; DBGVALUE-NEXT: DBG_VALUE [[REG4]]
%u.023 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%y.022 = phi i32 [ 13, %for.body.lr.ph ], [ %mul, %for.body ]
%x.021 = phi i32 [ 9, %for.body.lr.ph ], [ %add, %for.body ]
diff --git a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll
index 1fd2f9f056250..35b57978c99ef 100644
--- a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This test case was generated from the following phi-split.c program,
; using: clang phi-split.c -g -O1 -S -o - --target=i386 -emit-llvm
@@ -59,18 +64,30 @@ for.cond.cleanup: ; preds = %for.cond.cleanup.lo
for.body: ; preds = %for.body.lr.ph, %for.body
; CHECK-LABEL: bb.{{.*}}.for.body:
-; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG5:%[0-9]+]]:gr32_nosp = PHI
-; CHECK-NEXT: [[REG6:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG7:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, !19, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
-; CHECK-NEXT: DBG_VALUE [[REG3]], $noreg, !19, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
-; CHECK-NEXT: DBG_VALUE [[REG4]], $noreg, !18, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
-; CHECK-NEXT: DBG_VALUE [[REG5]], $noreg, !18, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
-; CHECK-NEXT: DBG_VALUE [[REG6]], $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
-; CHECK-NEXT: DBG_VALUE [[REG7]], $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; CHECK: [[REG2:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 5
+; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 6
+; CHECK-NEXT: [[REG4:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 7
+; CHECK-NEXT: [[REG5:%[0-9]+]]:gr32_nosp = PHI
+; INSTRREF-SAME: debug-instr-number 8
+; CHECK-NEXT: [[REG6:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 9
+; CHECK-NEXT: [[REG7:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 10
+; INSTRREF-NEXT: DBG_INSTR_REF 5, 0, !19, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 6, 0, !19, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 7, 0, !18, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 8, 0, !18, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 9, 0, !17, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 10, 0, !17, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !19, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, !19, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG4]], $noreg, !18, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG5]], $noreg, !18, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG6]], $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG7]], $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
%u.023 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%y.022 = phi i64 [ 13, %for.body.lr.ph ], [ %mul, %for.body ]
%x.021 = phi i64 [ 9, %for.body.lr.ph ], [ %add, %for.body ]
diff --git a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll
index a36085d9c1244..df83cd4424c56 100644
--- a/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This is a reproducer based on the test case from PR37321.
@@ -8,15 +13,23 @@
; fragment with just a few DBG_VALUE instructions).
; CHECK-LABEL: bb.{{.*}}.if.end36:
-; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG2:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
-; CHECK-NEXT: DBG_VALUE [[REG1]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
-; CHECK-NEXT: DBG_VALUE [[REG3]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 64, 16)
-; CHECK-NEXT: DBG_VALUE [[REG1]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 10, 32)
-; CHECK-NEXT: DBG_VALUE [[REG2]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 42, 13)
-; CHECK-NOT: DBG_VALUE
+; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 1
+; CHECK-NEXT: [[REG2:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 2
+; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI
+; INSTRREF-SAME: debug-instr-number 3
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 2, 0, !13, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 3, 0, !13, !DIExpression(DW_OP_LLVM_fragment, 64, 16)
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0, !12, !DIExpression(DW_OP_LLVM_fragment, 10, 32)
+; INSTRREF-NEXT: DBG_INSTR_REF 2, 0, !12, !DIExpression(DW_OP_LLVM_fragment, 42, 13)
+; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 32, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 64, 16)
+; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 10, 32)
+; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 42, 13)
+; CHECK-NOT: DBG_
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-w64-windows-gnu"
diff --git a/llvm/test/DebugInfo/X86/sdag-dbgvalue-ssareg.ll b/llvm/test/DebugInfo/X86/sdag-dbgvalue-ssareg.ll
index 67144be89f1ae..97b891c0fe681 100644
--- a/llvm/test/DebugInfo/X86/sdag-dbgvalue-ssareg.ll
+++ b/llvm/test/DebugInfo/X86/sdag-dbgvalue-ssareg.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; Test that dbg.values of an SSA variable that's not used in a basic block,
; is converted to a DBG_VALUE in that same basic block. We know that %1 is
@@ -13,6 +18,8 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 %arg0, i32 %arg1) local_unnamed_addr !dbg !11 {
entry:
+; CHECK-LABEL: bb.0.entry:
+; INSTRREF: ADD32ri8 {{.*}} debug-instr-number 1
%0 = add i32 %arg0, 42, !dbg !26
%1 = add i32 %arg1, 101, !dbg !26
%cmp = icmp eq i32 %1, 0
@@ -23,7 +30,8 @@ nextbb:
%2 = mul i32 %0, %arg1, !dbg !26
; CHECK: IMUL32rr
call void @llvm.dbg.value(metadata i32 %1, metadata !16, metadata !DIExpression()), !dbg !27
-; CHECK-NEXT: DBG_VALUE
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0
+; DBGVALUE-NEXT: DBG_VALUE
br label %exit, !dbg !26
; CHECK-LABEL: bb.{{.*}}.exit
diff --git a/llvm/test/DebugInfo/X86/sdag-ir-salvage.ll b/llvm/test/DebugInfo/X86/sdag-ir-salvage.ll
index 558d3d82166fa..2cc5a4a177b81 100644
--- a/llvm/test/DebugInfo/X86/sdag-ir-salvage.ll
+++ b/llvm/test/DebugInfo/X86/sdag-ir-salvage.ll
@@ -1,11 +1,21 @@
-; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare -stop-before finalize-isel %s -o - -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \
+; RUN: -stop-before finalize-isel %s -o - \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \
+; RUN: -stop-before finalize-isel %s -o - \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; Test that the dbg.value for %baz, which doesn't exist in the 'next' bb,
; can be salvaged back to the underlying argument vreg.
; CHECK: ![[AAAVAR:.*]] = !DILocalVariable(name: "aaa",
+; CHECK-LABEL: bb.0.entry:
+; INSTRREF: DBG_PHI $rdi, 1
; CHECK-LABEL: bb.1.next:
-; CHECK: DBG_VALUE %{{[0-9]+}}, $noreg, ![[AAAVAR]]
+; INSTRREF: DBG_INSTR_REF 1, 0, ![[AAAVAR]]
+; DBGVALUE: DBG_VALUE %{{[0-9]+}}, $noreg, ![[AAAVAR]]
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-linux-gnu"
diff --git a/llvm/test/DebugInfo/X86/sdag-salvage-add.ll b/llvm/test/DebugInfo/X86/sdag-salvage-add.ll
index 2b414477e3def..6bc03a635fb3d 100644
--- a/llvm/test/DebugInfo/X86/sdag-salvage-add.ll
+++ b/llvm/test/DebugInfo/X86/sdag-salvage-add.ll
@@ -1,5 +1,9 @@
-; RUN: llc -mtriple=x86_64-unknown-unknown -stop-before livedebugvalues %s -o - -experimental-debug-variable-locations=false \
-; RUN: | FileCheck %s
+; RUN: llc -mtriple=x86_64-unknown-unknown -stop-before livedebugvalues %s -o -\
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -mtriple=x86_64-unknown-unknown -stop-before livedebugvalues %s -o -\
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
;
; Generated at -O1 from:
; typedef struct {
@@ -20,13 +24,22 @@
; }
;
; The debug info is attached to the ADD 4096 operation, which doesn't survive
-; instruction selection as it is folded into the load.
+; instruction selection as it is folded into the load. As a result, we should
+; refer to s4 and myVar with complex expressions.
;
-; CHECK: ![[S4:.*]] = !DILocalVariable(name: "s4",
-; CHECK: ![[MYVAR:.*]] = !DILocalVariable(name: "myVar",
-; CHECK: DBG_VALUE $rax, $noreg, ![[MYVAR]],
-; CHECK-SAME: !DIExpression(DW_OP_plus_uconst, 4096, DW_OP_stack_value)
-; CHECK-NEXT: DBG_VALUE $rax, $noreg, ![[S4]],
+; NB: instruction referencing and DBG_VALUE modes produce debug insts in a
+;
diff erent order.
+;
+; CHECK: ![[S4:.*]] = !DILocalVariable(name: "s4",
+; CHECK: ![[MYVAR:.*]] = !DILocalVariable(name: "myVar",
+; CHECK: $rax = MOV64rm
+; INSTRREF-SAME: debug-instr-number 2,
+; INSTRREF-NEXT: DBG_INSTR_REF 2, 0, ![[S4]],
+; DBGVALUE-NEXT: DBG_VALUE $rax, $noreg, ![[MYVAR]],
+; CHECK-SAME: !DIExpression(DW_OP_plus_uconst, 4096, DW_OP_stack_value)
+
+; INSTRREF: DBG_INSTR_REF 2, 0, ![[MYVAR]],
+; DBGVALUE: DBG_VALUE $rax, $noreg, ![[S4]],
; CHECK-SAME: !DIExpression(DW_OP_plus_uconst, 4096, DW_OP_stack_value)
; CHECK-NEXT: $rdi = MOV64rm killed renamable $rax, 1, $noreg, 4096, $noreg,
diff --git a/llvm/test/DebugInfo/X86/sdag-transfer-dbgvalue.ll b/llvm/test/DebugInfo/X86/sdag-transfer-dbgvalue.ll
index e1dac4d2d10e0..094636c58bb4b 100644
--- a/llvm/test/DebugInfo/X86/sdag-transfer-dbgvalue.ll
+++ b/llvm/test/DebugInfo/X86/sdag-transfer-dbgvalue.ll
@@ -1,4 +1,9 @@
-; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=false \
+; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
+; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \
+; RUN: -experimental-debug-variable-locations=true \
+; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This tests that transferDbgValues() changes order of SDDbgValue transferred
; to another node and debug info for 'ADD32ri' appears *after* the instruction.
@@ -17,8 +22,10 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
target triple = "x86_64-unknown-linux-gnu"
; CHECK-LABEL: bb.0.entry:
-; CHECK: %[[REG:[0-9]+]]:gr32 = ADD32ri %1, 512
-; CHECK-NEXT: DBG_VALUE %[[REG]]
+; CHECK: %[[REG:[0-9]+]]:gr32 = ADD32ri %1, 512,
+; INSTRREF-SAME: debug-instr-number 1
+; INSTRREF-NEXT: DBG_INSTR_REF 1, 0
+; DBGVALUE-NEXT: DBG_VALUE %[[REG]]
; Function Attrs: nofree norecurse nounwind uwtable writeonly
define dso_local i32 @foo(i32 %a, i32* nocapture %b) local_unnamed_addr !dbg !7 {
More information about the llvm-commits
mailing list