[llvm] [DebugInfo][RemoveDIs] Handle dbg.declares in SelectionDAGISel (PR #73496)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 02:14:08 PST 2023
https://github.com/OCHyams updated https://github.com/llvm/llvm-project/pull/73496
>From 37cde421257f8e3e8b719e9b5c07fe47b3b59385 Mon Sep 17 00:00:00 2001
From: OCHyams <orlando.hyams at sony.com>
Date: Mon, 27 Nov 2023 10:06:04 +0000
Subject: [PATCH 1/2] [DebugInfo][RemoveDIs] Handle dbg.declares in
SelectionDAGISel
This is a boring mechanical update to support DPValues in SelectionDAG.
---
.../llvm/CodeGen/FunctionLoweringInfo.h | 1 +
.../SelectionDAG/FunctionLoweringInfo.cpp | 1 +
.../SelectionDAG/SelectionDAGBuilder.cpp | 120 ++++++++++--------
.../SelectionDAG/SelectionDAGBuilder.h | 3 +
.../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 8 ++
llvm/test/CodeGen/X86/dbg-combine.ll | 1 +
llvm/test/CodeGen/X86/selectiondag-order.ll | 1 +
.../Generic/2010-06-29-InlinedFnLocalVar.ll | 1 +
llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll | 1 +
llvm/test/DebugInfo/X86/DW_AT_const_value.ll | 1 +
llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll | 1 +
llvm/test/DebugInfo/X86/block-capture.ll | 3 +
.../X86/dbg-empty-metadata-lowering.ll | 6 +
.../X86/debug-info-block-captured-self.ll | 3 +
llvm/test/DebugInfo/X86/debug-info-blocks.ll | 3 +
.../X86/empty-metadata-dbg-declare.ll | 1 +
llvm/test/DebugInfo/X86/pieces-3.ll | 1 +
llvm/test/DebugInfo/X86/pieces-4.ll | 2 +
llvm/test/DebugInfo/X86/safestack-byval.ll | 2 +
.../X86/salvage-add-node-indirect.ll | 1 +
.../test/DebugInfo/X86/spill-indirect-nrvo.ll | 6 +-
.../DebugInfo/X86/spill-nontrivial-param.ll | 2 +
llvm/test/DebugInfo/X86/sret.ll | 2 +
llvm/test/DebugInfo/X86/union-const.ll | 2 +
llvm/test/DebugInfo/X86/vla-global.ll | 2 +
llvm/test/DebugInfo/X86/vla-multi.ll | 2 +
26 files changed, 124 insertions(+), 53 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
index 4c17e8dcc41a66e..79fcedd5dfc166a 100644
--- a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
+++ b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
@@ -191,6 +191,7 @@ class FunctionLoweringInfo {
/// Collection of dbg.declare instructions handled after argument
/// lowering and before ISel proper.
SmallPtrSet<const DbgDeclareInst *, 8> PreprocessedDbgDeclares;
+ SmallPtrSet<const DPValue *, 8> PreprocessedDPVs;
/// set - Initialize this FunctionLoweringInfo with the given Function
/// and its associated MachineFunction.
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 1d0a03ccfcdc6ae..2cb790590ae2dda 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -350,6 +350,7 @@ void FunctionLoweringInfo::clear() {
StatepointRelocationMaps.clear();
PreferredExtendType.clear();
PreprocessedDbgDeclares.clear();
+ PreprocessedDPVs.clear();
}
/// CreateReg - Allocate a single virtual register for the given type.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index da7d9ace4114a62..0e3f0c86538d915 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1148,6 +1148,60 @@ SDValue SelectionDAGBuilder::getControlRoot() {
return updateRoot(PendingExports);
}
+void SelectionDAGBuilder::handleDebugDeclare(Value *Address,
+ DILocalVariable *Variable,
+ DIExpression *Expression,
+ DebugLoc dl) {
+ assert(Variable && "Missing variable");
+
+ // Check if address has undef value.
+ if (!Address || isa<UndefValue>(Address) ||
+ (Address->use_empty() && !isa<Argument>(Address))) {
+ LLVM_DEBUG(
+ dbgs()
+ << "dbg_declare: Dropping debug info (bad/undef/unused-arg address)\n");
+ return;
+ }
+
+ bool isParameter = Variable->isParameter() || isa<Argument>(Address);
+
+ SDValue &N = NodeMap[Address];
+ if (!N.getNode() && isa<Argument>(Address))
+ // Check unused arguments map.
+ N = UnusedArgNodeMap[Address];
+ SDDbgValue *SDV;
+ if (N.getNode()) {
+ if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
+ Address = BCI->getOperand(0);
+ // Parameters are handled specially.
+ auto FINode = dyn_cast<FrameIndexSDNode>(N.getNode());
+ if (isParameter && FINode) {
+ // Byval parameter. We have a frame index at this point.
+ SDV = DAG.getFrameIndexDbgValue(Variable, Expression, FINode->getIndex(),
+ /*IsIndirect*/ true, dl, SDNodeOrder);
+ } else if (isa<Argument>(Address)) {
+ // Address is an argument, so try to emit its dbg value using
+ // virtual register info from the FuncInfo.ValueMap.
+ EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
+ FuncArgumentDbgValueKind::Declare, N);
+ return;
+ } else {
+ SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
+ true, dl, SDNodeOrder);
+ }
+ DAG.AddDbgValue(SDV, isParameter);
+ } else {
+ // If Address is an argument then try to emit its dbg value using
+ // virtual register info from the FuncInfo.ValueMap.
+ if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
+ FuncArgumentDbgValueKind::Declare, N)) {
+ LLVM_DEBUG(dbgs() << "dbg_declare: Dropping debug info"
+ << " (could not emit func-arg dbg_value)\n");
+ }
+ }
+ return;
+}
+
void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) {
// Add SDDbgValue nodes for any var locs here. Do so before updating
// SDNodeOrder, as this mapping is {Inst -> Locs BEFORE Inst}.
@@ -1182,6 +1236,14 @@ void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) {
DIExpression *Expression = DPV.getExpression();
dropDanglingDebugInfo(Variable, Expression);
+ if (DPV.getType() == DPValue::LocationType::Declare) {
+ LLVM_DEBUG(dbgs() << "SelectionDAG visiting dbg_declare: " << DPV
+ << "\n");
+ handleDebugDeclare(DPV.getVariableLocationOp(0), Variable, Expression,
+ DPV.getDebugLoc());
+ continue;
+ }
+
// A DPValue with no locations is a kill location.
SmallVector<Value *, 4> Values(DPV.location_ops());
if (Values.empty()) {
@@ -6243,61 +6305,15 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
if (AssignmentTrackingEnabled ||
FuncInfo.PreprocessedDbgDeclares.count(&DI))
return;
- // Assume dbg.declare can not currently use DIArgList, i.e.
- // it is non-variadic.
- assert(!DI.hasArgList() && "Only dbg.value should currently use DIArgList");
+ LLVM_DEBUG(dbgs() << "SelectionDAG visiting dbg_declare: " << DI << "\n");
DILocalVariable *Variable = DI.getVariable();
DIExpression *Expression = DI.getExpression();
dropDanglingDebugInfo(Variable, Expression);
- assert(Variable && "Missing variable");
- LLVM_DEBUG(dbgs() << "SelectionDAG visiting debug intrinsic: " << DI
- << "\n");
- // Check if address has undef value.
- const Value *Address = DI.getVariableLocationOp(0);
- if (!Address || isa<UndefValue>(Address) ||
- (Address->use_empty() && !isa<Argument>(Address))) {
- LLVM_DEBUG(dbgs() << "Dropping debug info for " << DI
- << " (bad/undef/unused-arg address)\n");
- return;
- }
-
- bool isParameter = Variable->isParameter() || isa<Argument>(Address);
-
- SDValue &N = NodeMap[Address];
- if (!N.getNode() && isa<Argument>(Address))
- // Check unused arguments map.
- N = UnusedArgNodeMap[Address];
- SDDbgValue *SDV;
- if (N.getNode()) {
- if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
- Address = BCI->getOperand(0);
- // Parameters are handled specially.
- auto FINode = dyn_cast<FrameIndexSDNode>(N.getNode());
- if (isParameter && FINode) {
- // Byval parameter. We have a frame index at this point.
- SDV =
- DAG.getFrameIndexDbgValue(Variable, Expression, FINode->getIndex(),
- /*IsIndirect*/ true, dl, SDNodeOrder);
- } else if (isa<Argument>(Address)) {
- // Address is an argument, so try to emit its dbg value using
- // virtual register info from the FuncInfo.ValueMap.
- EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
- FuncArgumentDbgValueKind::Declare, N);
- return;
- } else {
- SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
- true, dl, SDNodeOrder);
- }
- DAG.AddDbgValue(SDV, isParameter);
- } else {
- // If Address is an argument then try to emit its dbg value using
- // virtual register info from the FuncInfo.ValueMap.
- if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
- FuncArgumentDbgValueKind::Declare, N)) {
- LLVM_DEBUG(dbgs() << "Dropping debug info for " << DI
- << " (could not emit func-arg dbg_value)\n");
- }
- }
+ // Assume dbg.declare can not currently use DIArgList, i.e.
+ // it is non-variadic.
+ assert(!DI.hasArgList() && "Only dbg.value should currently use DIArgList");
+ handleDebugDeclare(DI.getVariableLocationOp(0), Variable,
+ Expression, DI.getDebugLoc());
return;
}
case Intrinsic::dbg_label: {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 5b55c3461b0b672..2e102c002c093ee 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -368,6 +368,9 @@ class SelectionDAGBuilder {
void handleKillDebugValue(DILocalVariable *Var, DIExpression *Expr,
DebugLoc DbgLoc, unsigned Order);
+ void handleDebugDeclare(Value *Address, DILocalVariable *Variable,
+ DIExpression *Expression, DebugLoc DL);
+
/// Evict any dangling debug information, attempting to salvage it first.
void resolveOrClearDbgInfo();
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index a0af6faa7fbcefb..45e1815161272bf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1461,6 +1461,14 @@ static void processDbgDeclares(FunctionLoweringInfo &FuncInfo) {
if (DI && processDbgDeclare(FuncInfo, DI->getAddress(), DI->getExpression(),
DI->getVariable(), DI->getDebugLoc()))
FuncInfo.PreprocessedDbgDeclares.insert(DI);
+
+ for (const DPValue &DPV : I.getDbgValueRange()) {
+ if (DPV.getType() == DPValue::LocationType::Declare &&
+ processDbgDeclare(FuncInfo, DPV.getVariableLocationOp(0),
+ DPV.getExpression(), DPV.getVariable(),
+ DPV.getDebugLoc()))
+ FuncInfo.PreprocessedDPVs.insert(&DPV);
+ }
}
}
diff --git a/llvm/test/CodeGen/X86/dbg-combine.ll b/llvm/test/CodeGen/X86/dbg-combine.ll
index b3d2213b90c0a61..d6065f1318ae050 100644
--- a/llvm/test/CodeGen/X86/dbg-combine.ll
+++ b/llvm/test/CodeGen/X86/dbg-combine.ll
@@ -1,4 +1,5 @@
; RUN: llc -mtriple x86_64-pc-linux -O0 < %s | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple x86_64-pc-linux -O0 < %s | FileCheck %s
; Make sure that the sequence of debug locations for function foo is correctly
; generated. More specifically, .loc entries for lines 4,5,6,7 must appear in
diff --git a/llvm/test/CodeGen/X86/selectiondag-order.ll b/llvm/test/CodeGen/X86/selectiondag-order.ll
index 163e2cb90b2febd..417b12bbd73f17b 100644
--- a/llvm/test/CodeGen/X86/selectiondag-order.ll
+++ b/llvm/test/CodeGen/X86/selectiondag-order.ll
@@ -1,6 +1,7 @@
; Check that debug intrinsics do not affect code generation.
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck --check-prefix=X86-CHECK %s
+; RUN: llc --try-experimental-debuginfo-iterators < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck --check-prefix=X86-CHECK %s
define i64 @simulate(<2 x i32> %a) {
entry:
diff --git a/llvm/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll b/llvm/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
index 87d75c16dd8e34e..2a5d5e776b9347a 100644
--- a/llvm/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
+++ b/llvm/test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
@@ -1,4 +1,5 @@
; RUN: %llc_dwarf -O2 %s -o - | FileCheck %s
+; RUN: %llc_dwarf --try-experimental-debuginfo-iterators -O2 %s -o - | FileCheck %s
; Check struct X for dead variable xyz from inlined function foo.
; CHECK: {{.section.*debug_info|.*dwinfo:}}
diff --git a/llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll b/llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll
index 9e5bc3ed0db5886..d4d0ec2d813ca90 100644
--- a/llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll
+++ b/llvm/test/DebugInfo/Mips/InlinedFnLocalVar.ll
@@ -1,4 +1,5 @@
; RUN: llc -mtriple mips-linux-gnu -O2 %s -o - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple mips-linux-gnu -O2 %s -o - | FileCheck %s
; Check struct X for dead variable xyz from inlined function foo.
; CHECK: .section .debug_info,"", at 0x7000001e
diff --git a/llvm/test/DebugInfo/X86/DW_AT_const_value.ll b/llvm/test/DebugInfo/X86/DW_AT_const_value.ll
index 39d718a457d3534..ecb423a0a113946 100644
--- a/llvm/test/DebugInfo/X86/DW_AT_const_value.ll
+++ b/llvm/test/DebugInfo/X86/DW_AT_const_value.ll
@@ -1,4 +1,5 @@
; RUN: llc %s -o - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators %s -o - | FileCheck %s
;; Check single location variables of various types with a constant value are
;; emitted with a DW_AT_const_value attribute.
diff --git a/llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll b/llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll
index 7f659bf9042a9d7..0b27ec8194a1cd6 100644
--- a/llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll
+++ b/llvm/test/DebugInfo/X86/InlinedFnLocalVar.ll
@@ -1,4 +1,5 @@
; RUN: llc -mtriple i686-pc-cygwin -O2 %s -o - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple i686-pc-cygwin -O2 %s -o - | FileCheck %s
; Check struct X for dead variable xyz from inlined function foo.
; CHECK: Lsection_info
diff --git a/llvm/test/DebugInfo/X86/block-capture.ll b/llvm/test/DebugInfo/X86/block-capture.ll
index f78ce32fb34aee0..585526fea148c0c 100644
--- a/llvm/test/DebugInfo/X86/block-capture.ll
+++ b/llvm/test/DebugInfo/X86/block-capture.ll
@@ -1,6 +1,9 @@
; RUN: llc %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators %s -o %t -filetype=obj
+; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
+
; Checks that we emit debug info for the block variable declare.
; CHECK: DW_TAG_subprogram
; CHECK: DW_TAG_variable
diff --git a/llvm/test/DebugInfo/X86/dbg-empty-metadata-lowering.ll b/llvm/test/DebugInfo/X86/dbg-empty-metadata-lowering.ll
index b98e99c53dfe613..a5edac3ead5046f 100644
--- a/llvm/test/DebugInfo/X86/dbg-empty-metadata-lowering.ll
+++ b/llvm/test/DebugInfo/X86/dbg-empty-metadata-lowering.ll
@@ -2,6 +2,9 @@
; RUN: | FileCheck %s --implicit-check-not=DBG --check-prefixes=AT-DISABLED,BOTH
; RUN: llc %s -stop-after=finalize-isel -o - --try-experimental-debuginfo-iterators \
; RUN: | FileCheck %s --implicit-check-not=DBG --check-prefixes=AT-DISABLED,BOTH
+; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \
+; RUN: | FileCheck %s --implicit-check-not=DBG --check-prefixes=AT-DISABLED,BOTH
+
;; Check that dbg.values with empty metadata are treated as kills (i.e. become
;; DBG_VALUE $noreg, ...). dbg.declares with empty metadata location operands
;; should be ignored.
@@ -9,6 +12,9 @@
; RUN: sed 's/;Uncomment-with-sed//g' < %s \
; RUN: | llc -stop-after=finalize-isel -o - \
; RUN: | FileCheck %s --implicit-check-not=DBG --check-prefixes=AT-ENABLED,BOTH
+; RUN: sed 's/;Uncomment-with-sed//g' < %s \
+; RUN: | llc --try-experimental-debuginfo-iterators -stop-after=finalize-isel -o - \
+; RUN: | FileCheck %s --implicit-check-not=DBG --check-prefixes=AT-ENABLED,BOTH
;; Check the same behaviour occurs with assignment tracking enabled.
;; First ensure assignment tracking is truly unset/set.
diff --git a/llvm/test/DebugInfo/X86/debug-info-block-captured-self.ll b/llvm/test/DebugInfo/X86/debug-info-block-captured-self.ll
index d96ea5190b864bf..c70b51f7f8d10cd 100644
--- a/llvm/test/DebugInfo/X86/debug-info-block-captured-self.ll
+++ b/llvm/test/DebugInfo/X86/debug-info-block-captured-self.ll
@@ -1,6 +1,9 @@
; RUN: llc -mtriple x86_64-apple-darwin -filetype=obj -o %t.o < %s
; RUN: llvm-dwarfdump %t.o | FileCheck %s
;
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple x86_64-apple-darwin -filetype=obj -o %t.o < %s
+; RUN: llvm-dwarfdump %t.o | FileCheck %s
+;
; Test that DW_AT_location is generated for a captured "self" inside a
; block.
;
diff --git a/llvm/test/DebugInfo/X86/debug-info-blocks.ll b/llvm/test/DebugInfo/X86/debug-info-blocks.ll
index 0914fa68620c98f..5dacd711ad60497 100644
--- a/llvm/test/DebugInfo/X86/debug-info-blocks.ll
+++ b/llvm/test/DebugInfo/X86/debug-info-blocks.ll
@@ -1,6 +1,9 @@
; RUN: llc -mtriple x86_64-apple-darwin -filetype=obj -o %t.o < %s
; RUN: llvm-dwarfdump -v -debug-info %t.o | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple x86_64-apple-darwin -filetype=obj -o %t.o < %s
+; RUN: llvm-dwarfdump -v -debug-info %t.o | FileCheck %s
+
; Generated from llvm/tools/clang/test/CodeGenObjC/debug-info-blocks.m
; rdar://problem/9279956
; test that the DW_AT_location of self is at ( fbreg +{{[0-9]+}}, deref, +{{[0-9]+}} )
diff --git a/llvm/test/DebugInfo/X86/empty-metadata-dbg-declare.ll b/llvm/test/DebugInfo/X86/empty-metadata-dbg-declare.ll
index 8ae4e7b183e9a0c..241a39f3d899a95 100644
--- a/llvm/test/DebugInfo/X86/empty-metadata-dbg-declare.ll
+++ b/llvm/test/DebugInfo/X86/empty-metadata-dbg-declare.ll
@@ -1,4 +1,5 @@
; RUN: llc %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG
+; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG
;; Check that a single "empty metadata" dbg.declare doesn't accidentally cause
;; other dbg.declares in the function to go missing.
diff --git a/llvm/test/DebugInfo/X86/pieces-3.ll b/llvm/test/DebugInfo/X86/pieces-3.ll
index dfd7b3c48ef93b0..60bf758b4985650 100644
--- a/llvm/test/DebugInfo/X86/pieces-3.ll
+++ b/llvm/test/DebugInfo/X86/pieces-3.ll
@@ -1,4 +1,5 @@
; RUN: llc %s -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump -v - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators %s -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump -v - | FileCheck %s
;
; // Compile with -O1
; typedef struct {
diff --git a/llvm/test/DebugInfo/X86/pieces-4.ll b/llvm/test/DebugInfo/X86/pieces-4.ll
index adc93fc93a2cd5a..aa93bd6a7f5f069 100644
--- a/llvm/test/DebugInfo/X86/pieces-4.ll
+++ b/llvm/test/DebugInfo/X86/pieces-4.ll
@@ -1,5 +1,7 @@
; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s
; RUN: llc -filetype=obj < %s -experimental-debug-variable-locations=true | llvm-dwarfdump -debug-loc - | FileCheck %s --check-prefix=DWARF
+; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=true | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -filetype=obj < %s -experimental-debug-variable-locations=true | llvm-dwarfdump -debug-loc - | FileCheck %s --check-prefix=DWARF
; Compile the following with -O1:
diff --git a/llvm/test/DebugInfo/X86/safestack-byval.ll b/llvm/test/DebugInfo/X86/safestack-byval.ll
index acaa8031537cabf..168cddd80633d98 100644
--- a/llvm/test/DebugInfo/X86/safestack-byval.ll
+++ b/llvm/test/DebugInfo/X86/safestack-byval.ll
@@ -3,6 +3,8 @@
; SafeStack for unsafe byval arguments.
; RUN: llc -mtriple=x86_64-unknown-unknown --experimental-debug-variable-locations=false -stop-after finalize-isel %s -o - | FileCheck %s --check-prefixes=CHECK,NORMAL
; RUN: llc -mtriple=x86_64-unknown-unknown --experimental-debug-variable-locations -stop-after finalize-isel %s -o - | FileCheck %s --check-prefixes=CHECK,INSTRREF
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-unknown-unknown --experimental-debug-variable-locations=false -stop-after finalize-isel %s -o - | FileCheck %s --check-prefixes=CHECK,NORMAL
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-unknown-unknown --experimental-debug-variable-locations -stop-after finalize-isel %s -o - | FileCheck %s --check-prefixes=CHECK,INSTRREF
; This was built by compiling the following source with SafeStack and
; simplifying the result a little.
diff --git a/llvm/test/DebugInfo/X86/salvage-add-node-indirect.ll b/llvm/test/DebugInfo/X86/salvage-add-node-indirect.ll
index cae8a479a5ad9da..967721bde8a34ca 100644
--- a/llvm/test/DebugInfo/X86/salvage-add-node-indirect.ll
+++ b/llvm/test/DebugInfo/X86/salvage-add-node-indirect.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
; RUN: llc -mtriple=x86_64 %s -start-before=x86-isel -o - -stop-after=x86-isel | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64 %s -start-before=x86-isel -o - -stop-after=x86-isel | FileCheck %s
; Verify that we don't crash due to attempting to turn the indirect debug value
; in @test_non_constant variadic when salvaging the ADD node with non-constant
diff --git a/llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll b/llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
index 0b18318c53a8564..5193b4c0e67b3ca 100644
--- a/llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
+++ b/llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll
@@ -1,7 +1,11 @@
; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPT %s
; RUN: llc -O0 < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPTNONE %s
; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPT %s
-; RUN: llc -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
+; RUN: llc --try-experimental-debuginfo-iterators -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
+; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPT %s
+; RUN: llc --try-experimental-debuginfo-iterators -O0 < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPTNONE %s
+; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPT %s
+; RUN: llc --try-experimental-debuginfo-iterators -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
; Make sure we insert DW_OP_deref when spilling indirect DBG_VALUE instructions.
diff --git a/llvm/test/DebugInfo/X86/spill-nontrivial-param.ll b/llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
index 1e01f2cd97032d3..9c05b050e733862 100644
--- a/llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
+++ b/llvm/test/DebugInfo/X86/spill-nontrivial-param.ll
@@ -1,5 +1,7 @@
; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck %s
; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=false | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=true | FileCheck %s
; Make sure we insert DW_OP_deref when spilling indirect DBG_VALUE instructions.
; In this example, 'nt' is passed by address because it is not trivially
diff --git a/llvm/test/DebugInfo/X86/sret.ll b/llvm/test/DebugInfo/X86/sret.ll
index 017fc968d4276c3..09211a877b5982a 100644
--- a/llvm/test/DebugInfo/X86/sret.ll
+++ b/llvm/test/DebugInfo/X86/sret.ll
@@ -1,5 +1,7 @@
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix=CHECK-DWO
+; RUN: llc --try-experimental-debuginfo-iterators -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix=CHECK-DWO
; Based on the debuginfo-tests/sret.cpp code.
diff --git a/llvm/test/DebugInfo/X86/union-const.ll b/llvm/test/DebugInfo/X86/union-const.ll
index e9aafc9c228e4cd..1bb5cc26b1fe2df 100644
--- a/llvm/test/DebugInfo/X86/union-const.ll
+++ b/llvm/test/DebugInfo/X86/union-const.ll
@@ -1,4 +1,6 @@
; RUN: llc -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
+
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_const_value [DW_FORM_udata] (0)
; CHECK-NEXT: DW_AT_name {{.*}}"a"
diff --git a/llvm/test/DebugInfo/X86/vla-global.ll b/llvm/test/DebugInfo/X86/vla-global.ll
index d1a85bb7407b094..ee43ea166b7052a 100644
--- a/llvm/test/DebugInfo/X86/vla-global.ll
+++ b/llvm/test/DebugInfo/X86/vla-global.ll
@@ -1,4 +1,6 @@
; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
+
; CHECK: 0x00000[[G:.*]]: DW_TAG_variable
; CHECK-NEXT: DW_AT_name ("g")
; CHECK: DW_TAG_array_type
diff --git a/llvm/test/DebugInfo/X86/vla-multi.ll b/llvm/test/DebugInfo/X86/vla-multi.ll
index 210250ee9d6624f..911918338c21d15 100644
--- a/llvm/test/DebugInfo/X86/vla-multi.ll
+++ b/llvm/test/DebugInfo/X86/vla-multi.ll
@@ -1,4 +1,6 @@
; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
+; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
+
; Test debug info for multidimensional arrays.
;
; void f(int i, int j, int k, int r) {
>From d601d0758b02d618104a26d2adacee67aa2069ac Mon Sep 17 00:00:00 2001
From: OCHyams <orlando.hyams at sony.com>
Date: Mon, 27 Nov 2023 10:13:27 +0000
Subject: [PATCH 2/2] fix copy-pasted existing style issues
---
.../SelectionDAG/SelectionDAGBuilder.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 0e3f0c86538d915..75c1209177300bd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1151,7 +1151,7 @@ SDValue SelectionDAGBuilder::getControlRoot() {
void SelectionDAGBuilder::handleDebugDeclare(Value *Address,
DILocalVariable *Variable,
DIExpression *Expression,
- DebugLoc dl) {
+ DebugLoc DL) {
assert(Variable && "Missing variable");
// Check if address has undef value.
@@ -1163,7 +1163,7 @@ void SelectionDAGBuilder::handleDebugDeclare(Value *Address,
return;
}
- bool isParameter = Variable->isParameter() || isa<Argument>(Address);
+ bool IsParameter = Variable->isParameter() || isa<Argument>(Address);
SDValue &N = NodeMap[Address];
if (!N.getNode() && isa<Argument>(Address))
@@ -1174,26 +1174,26 @@ void SelectionDAGBuilder::handleDebugDeclare(Value *Address,
if (const BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
Address = BCI->getOperand(0);
// Parameters are handled specially.
- auto FINode = dyn_cast<FrameIndexSDNode>(N.getNode());
- if (isParameter && FINode) {
+ auto *FINode = dyn_cast<FrameIndexSDNode>(N.getNode());
+ if (IsParameter && FINode) {
// Byval parameter. We have a frame index at this point.
SDV = DAG.getFrameIndexDbgValue(Variable, Expression, FINode->getIndex(),
- /*IsIndirect*/ true, dl, SDNodeOrder);
+ /*IsIndirect*/ true, DL, SDNodeOrder);
} else if (isa<Argument>(Address)) {
// Address is an argument, so try to emit its dbg value using
// virtual register info from the FuncInfo.ValueMap.
- EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
+ EmitFuncArgumentDbgValue(Address, Variable, Expression, DL,
FuncArgumentDbgValueKind::Declare, N);
return;
} else {
SDV = DAG.getDbgValue(Variable, Expression, N.getNode(), N.getResNo(),
- true, dl, SDNodeOrder);
+ true, DL, SDNodeOrder);
}
- DAG.AddDbgValue(SDV, isParameter);
+ DAG.AddDbgValue(SDV, IsParameter);
} else {
// If Address is an argument then try to emit its dbg value using
// virtual register info from the FuncInfo.ValueMap.
- if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, dl,
+ if (!EmitFuncArgumentDbgValue(Address, Variable, Expression, DL,
FuncArgumentDbgValueKind::Declare, N)) {
LLVM_DEBUG(dbgs() << "dbg_declare: Dropping debug info"
<< " (could not emit func-arg dbg_value)\n");
More information about the llvm-commits
mailing list