[llvm] [RemoveDIs][DebugInfo] Add DPValue checks to the verifier, prepare DPValue for parsing support (PR #79810)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 08:21:52 PST 2024
https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/79810
>From fa711ec7e4c2e8287b8d7d01b618b09e72be9bf4 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <Stephen.Tozer at Sony.com>
Date: Mon, 29 Jan 2024 09:48:55 +0000
Subject: [PATCH 1/4] Add pre-parse changes (verifier, DPValue class interface)
---
.../include/llvm/IR/DebugProgramInstruction.h | 7 +-
llvm/lib/IR/AsmWriter.cpp | 6 +-
llvm/lib/IR/DebugProgramInstruction.cpp | 6 ++
llvm/lib/IR/Verifier.cpp | 97 +++++++++++++++++++
4 files changed, 110 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 97089098ee5352..2dd546ce709c76 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -224,7 +224,7 @@ class DPValue : public DbgRecord, protected DebugValueUser {
// DebugValueUser superclass instead. The referred to Value can either be a
// ValueAsMetadata or a DIArgList.
- DILocalVariable *Variable;
+ TrackingMDNodeRef Variable;
DIExpression *Expression;
DIExpression *AddressExpression;
@@ -331,7 +331,7 @@ class DPValue : public DbgRecord, protected DebugValueUser {
void addVariableLocationOps(ArrayRef<Value *> NewValues,
DIExpression *NewExpr);
- void setVariable(DILocalVariable *NewVar) { Variable = NewVar; }
+ void setVariable(DILocalVariable *NewVar);
void setExpression(DIExpression *NewExpr) { Expression = NewExpr; }
@@ -349,7 +349,8 @@ class DPValue : public DbgRecord, protected DebugValueUser {
void setKillLocation();
bool isKillLocation() const;
- DILocalVariable *getVariable() const { return Variable; }
+ DILocalVariable *getVariable() const;
+ MDNode *getRawVariable() const { return Variable; }
DIExpression *getExpression() const { return Expression; }
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index a3da6ca811489f..4e1e48b4ad4a35 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1143,15 +1143,15 @@ void SlotTracker::processDbgRecordMetadata(const DbgRecord &DR) {
// Process metadata used by DbgRecords; we only specifically care about the
// DILocalVariable, DILocation, and DIAssignID fields, as the Value and
// Expression fields should only be printed inline and so do not use a slot.
- CreateMetadataSlot(DPV->getVariable());
+ CreateMetadataSlot(DPV->getRawVariable());
if (DPV->isDbgAssign())
- CreateMetadataSlot(DPV->getAssignID());
+ CreateMetadataSlot(cast<MDNode>(DPV->getRawAssignID()));
} else if (const DPLabel *DPL = dyn_cast<const DPLabel>(&DR)) {
CreateMetadataSlot(DPL->getLabel());
} else {
llvm_unreachable("unsupported DbgRecord kind");
}
- CreateMetadataSlot(DR.getDebugLoc());
+ CreateMetadataSlot(DR.getDebugLoc().getAsMDNode());
}
void SlotTracker::processInstructionMetadata(const Instruction &I) {
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index 389bac4de6a1cb..3a8b94a87bbcf0 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -175,6 +175,8 @@ DPValue *DPValue::createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val,
return NewDPVAssign;
}
+void DPValue::setVariable(DILocalVariable *NewVar) { Variable.reset(NewVar); }
+
iterator_range<DPValue::location_op_iterator> DPValue::location_ops() const {
auto *MD = getRawLocation();
// If a Value has been deleted, the "location" for this DPValue will be
@@ -313,6 +315,10 @@ bool DPValue::isKillLocation() const {
any_of(location_ops(), [](Value *V) { return isa<UndefValue>(V); });
}
+DILocalVariable *DPValue::getVariable() const {
+ return cast<DILocalVariable>(Variable.get());
+}
+
std::optional<uint64_t> DPValue::getFragmentSizeInBits() const {
if (auto Fragment = getExpression()->getFragmentInfo())
return Fragment->SizeInBits;
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4f321bc516cc39..50c7ba61b632ac 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -178,6 +178,26 @@ struct VerifierSupport {
V->print(*OS, MST, false);
}
+ void Write(DPValue::LocationType Type) {
+ switch (Type) {
+ case DPValue::LocationType::Value:
+ *OS << "value";
+ break;
+ case DPValue::LocationType::Declare:
+ *OS << "declare";
+ break;
+ case DPValue::LocationType::Assign:
+ *OS << "assign";
+ break;
+ case DPValue::LocationType::End:
+ *OS << "end";
+ break;
+ case DPValue::LocationType::Any:
+ *OS << "any";
+ break;
+ };
+ }
+
void Write(const Metadata *MD) {
if (!MD)
return;
@@ -522,6 +542,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void visitTemplateParams(const MDNode &N, const Metadata &RawParams);
+ void visit(DPValue &DPV);
// InstVisitor overrides...
using InstVisitor<Verifier>::visit;
void visit(Instruction &I);
@@ -650,6 +671,8 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
} while (false)
void Verifier::visit(Instruction &I) {
+ for (auto &DPV : I.getDbgValueRange())
+ visit(DPV);
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
Check(I.getOperand(i) != nullptr, "Operand is null", &I);
InstVisitor<Verifier>::visit(I);
@@ -6148,6 +6171,80 @@ static DISubprogram *getSubprogram(Metadata *LocalScope) {
return nullptr;
}
+void Verifier::visit(DPValue &DPV) {
+ CheckDI(DPV.getType() == DPValue::LocationType::Value ||
+ DPV.getType() == DPValue::LocationType::Declare ||
+ DPV.getType() == DPValue::LocationType::Assign,
+ "invalid #dbg record type", &DPV, DPV.getType());
+ StringRef Kind;
+ switch (DPV.getType()) {
+ case DPValue::LocationType::Value:
+ Kind = "value";
+ break;
+ case DPValue::LocationType::Declare:
+ Kind = "declare";
+ break;
+ case DPValue::LocationType::Assign:
+ Kind = "assign";
+ break;
+ default:
+ llvm_unreachable("Tried to print a DPValue with an invalid LocationType!");
+ };
+ auto *MD = DPV.getRawLocation();
+ CheckDI(isa<ValueAsMetadata>(MD) || isa<DIArgList>(MD) ||
+ (isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands()),
+ "invalid #dbg_" + Kind + " address/value", &DPV, MD);
+ CheckDI(isa<DILocalVariable>(DPV.getRawVariable()),
+ "invalid #dbg_" + Kind + " variable", &DPV, DPV.getRawVariable());
+ CheckDI(DPV.getExpression(), "missing #dbg_" + Kind + " expression", &DPV,
+ DPV.getExpression());
+
+ if (DPV.isDbgAssign()) {
+ CheckDI(isa<DIAssignID>(DPV.getRawAssignID()),
+ "invalid #dbg_assign DIAssignID", &DPV, DPV.getRawAssignID());
+ const auto *RawAddr = DPV.getRawAddress();
+ CheckDI(
+ isa<ValueAsMetadata>(RawAddr) ||
+ (isa<MDNode>(RawAddr) && !cast<MDNode>(RawAddr)->getNumOperands()),
+ "invalid #dbg_assign address", &DPV, DPV.getRawAddress());
+ CheckDI(DPV.getAddressExpression(),
+ "missing #dbg_assign address expression", &DPV,
+ DPV.getAddressExpression());
+ // All of the linked instructions should be in the same function as DPV.
+ for (Instruction *I : at::getAssignmentInsts(&DPV))
+ CheckDI(DPV.getFunction() == I->getFunction(),
+ "inst not in same function as #dbg_assign", I, &DPV);
+ }
+
+ if (MDNode *N = DPV.getDebugLoc().getAsMDNode()) {
+ CheckDI(isa<DILocation>(N), "invalid #dbg_" + Kind + " location", &DPV, N);
+ visitDILocation(*cast<DILocation>(N));
+ }
+
+ BasicBlock *BB = DPV.getParent();
+ Function *F = BB ? BB->getParent() : nullptr;
+
+ // The scopes for variables and !dbg attachments must agree.
+ DILocalVariable *Var = DPV.getVariable();
+ DILocation *Loc = DPV.getDebugLoc();
+ CheckDI(Loc, "missing #dbg_" + Kind + " DILocation", &DPV, BB, F);
+
+ DISubprogram *VarSP = getSubprogram(Var->getRawScope());
+ DISubprogram *LocSP = getSubprogram(Loc->getRawScope());
+ if (!VarSP || !LocSP)
+ return; // Broken scope chains are checked elsewhere.
+
+ CheckDI(VarSP == LocSP,
+ "mismatched subprogram between #dbg_" + Kind +
+ " variable and DILocation",
+ &DPV, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
+ Loc->getScope()->getSubprogram());
+
+ // This check is redundant with one in visitLocalVariable().
+ CheckDI(isType(Var->getRawType()), "invalid type ref", Var,
+ Var->getRawType());
+}
+
void Verifier::visitVPIntrinsic(VPIntrinsic &VPI) {
if (auto *VPCast = dyn_cast<VPCastIntrinsic>(&VPI)) {
auto *RetTy = cast<VectorType>(VPCast->getType());
>From 1a7275369741ce7911f62dc50e552f2934466214 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 22 Feb 2024 18:13:09 +0000
Subject: [PATCH 2/4] WIP fixes
---
llvm/lib/IR/Verifier.cpp | 48 +++++++++++++++--------------
llvm/unittests/IR/DebugInfoTest.cpp | 13 ++++++--
2 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 50c7ba61b632ac..67ccda9cb0612d 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -545,6 +545,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void visit(DPValue &DPV);
// InstVisitor overrides...
using InstVisitor<Verifier>::visit;
+ void visitDbgRecords(Instruction &I);
void visit(Instruction &I);
void visitTruncInst(TruncInst &I);
@@ -670,9 +671,19 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
} \
} while (false)
-void Verifier::visit(Instruction &I) {
- for (auto &DPV : I.getDbgValueRange())
+void Verifier::visitDbgRecords(Instruction &I) {
+ if (!I.DbgMarker)
+ return;
+ CheckDI(I.DbgMarker->MarkedInstr == &I, "Instruction has invalid DbgMarker", &I);
+ CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(), "PHI Node must not have any attached DbgRecords", &I);
+ for (auto &DPV : I.getDbgValueRange()) {
+ CheckDI(DPV.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker", &I, &DPV);
visit(DPV);
+ }
+}
+
+void Verifier::visit(Instruction &I) {
+ visitDbgRecords(I);
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
Check(I.getOperand(i) != nullptr, "Operand is null", &I);
InstVisitor<Verifier>::visit(I);
@@ -3000,6 +3011,7 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
// Confirm that no issues arise from the debug program.
if (BB.IsNewDbgInfoFormat) {
+ CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!", &BB);
// Configure the validate function to not fire assertions, instead print
// errors and return true if there's a problem.
bool RetVal = BB.validateDbgValues(false, true, OS);
@@ -6176,33 +6188,24 @@ void Verifier::visit(DPValue &DPV) {
DPV.getType() == DPValue::LocationType::Declare ||
DPV.getType() == DPValue::LocationType::Assign,
"invalid #dbg record type", &DPV, DPV.getType());
- StringRef Kind;
- switch (DPV.getType()) {
- case DPValue::LocationType::Value:
- Kind = "value";
- break;
- case DPValue::LocationType::Declare:
- Kind = "declare";
- break;
- case DPValue::LocationType::Assign:
- Kind = "assign";
- break;
- default:
- llvm_unreachable("Tried to print a DPValue with an invalid LocationType!");
- };
+ // The location for a DPValue must be either a ValueAsMetadata, DIArgList, or
+ // an empty MDNode (which is a legacy representation for an "undef" location).
auto *MD = DPV.getRawLocation();
CheckDI(isa<ValueAsMetadata>(MD) || isa<DIArgList>(MD) ||
(isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands()),
- "invalid #dbg_" + Kind + " address/value", &DPV, MD);
+ "invalid #dbg record address/value", &DPV, MD);
CheckDI(isa<DILocalVariable>(DPV.getRawVariable()),
- "invalid #dbg_" + Kind + " variable", &DPV, DPV.getRawVariable());
- CheckDI(DPV.getExpression(), "missing #dbg_" + Kind + " expression", &DPV,
+ "invalid #dbg record variable", &DPV, DPV.getRawVariable());
+ CheckDI(DPV.getExpression(), "missing #dbg record expression", &DPV,
DPV.getExpression());
if (DPV.isDbgAssign()) {
CheckDI(isa<DIAssignID>(DPV.getRawAssignID()),
"invalid #dbg_assign DIAssignID", &DPV, DPV.getRawAssignID());
const auto *RawAddr = DPV.getRawAddress();
+ // Similarly to the location above, the address for an assign DPValue must
+ // be a ValueAsMetadata or an empty MDNode, which represents an undef
+ // address.
CheckDI(
isa<ValueAsMetadata>(RawAddr) ||
(isa<MDNode>(RawAddr) && !cast<MDNode>(RawAddr)->getNumOperands()),
@@ -6217,7 +6220,7 @@ void Verifier::visit(DPValue &DPV) {
}
if (MDNode *N = DPV.getDebugLoc().getAsMDNode()) {
- CheckDI(isa<DILocation>(N), "invalid #dbg_" + Kind + " location", &DPV, N);
+ CheckDI(isa<DILocation>(N), "invalid #dbg record location", &DPV, N);
visitDILocation(*cast<DILocation>(N));
}
@@ -6227,7 +6230,7 @@ void Verifier::visit(DPValue &DPV) {
// The scopes for variables and !dbg attachments must agree.
DILocalVariable *Var = DPV.getVariable();
DILocation *Loc = DPV.getDebugLoc();
- CheckDI(Loc, "missing #dbg_" + Kind + " DILocation", &DPV, BB, F);
+ CheckDI(Loc, "missing #dbg record DILocation", &DPV, BB, F);
DISubprogram *VarSP = getSubprogram(Var->getRawScope());
DISubprogram *LocSP = getSubprogram(Loc->getRawScope());
@@ -6235,8 +6238,7 @@ void Verifier::visit(DPValue &DPV) {
return; // Broken scope chains are checked elsewhere.
CheckDI(VarSP == LocSP,
- "mismatched subprogram between #dbg_" + Kind +
- " variable and DILocation",
+ "mismatched subprogram between #dbg record variable and DILocation",
&DPV, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
Loc->getScope()->getSubprogram());
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index 65db93e537f7df..c99f928de8a9de 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -1082,7 +1082,10 @@ TEST(MetadataTest, DPValueConversionRoutines) {
EXPECT_FALSE(BB1->IsNewDbgInfoFormat);
// Validating the block for DPValues / DPMarkers shouldn't fail -- there's
// no data stored right now.
- EXPECT_FALSE(BB1->validateDbgValues(false, false));
+ bool BrokenDebugInfo = false;
+ bool Error = verifyModule(*M, &errs(), &BrokenDebugInfo);
+ EXPECT_FALSE(Error);
+ EXPECT_FALSE(BrokenDebugInfo);
// Function and module should be marked as not having the new format too.
EXPECT_FALSE(F->IsNewDbgInfoFormat);
@@ -1135,13 +1138,17 @@ TEST(MetadataTest, DPValueConversionRoutines) {
EXPECT_TRUE(!Inst.DbgMarker || Inst.DbgMarker->StoredDPValues.empty());
// Validating the first block should continue to not be a problem,
- EXPECT_FALSE(BB1->validateDbgValues(false, false));
+ Error = verifyModule(*M, &errs(), &BrokenDebugInfo);
+ EXPECT_FALSE(Error);
+ EXPECT_FALSE(BrokenDebugInfo);
// But if we were to break something, it should be able to fire. Don't attempt
// to comprehensively test the validator, it's a smoke-test rather than a
// "proper" verification pass.
DPV1->setMarker(nullptr);
// A marker pointing the wrong way should be an error.
- EXPECT_TRUE(BB1->validateDbgValues(false, false));
+ Error = verifyModule(*M, &errs(), &BrokenDebugInfo);
+ EXPECT_FALSE(Error);
+ EXPECT_TRUE(BrokenDebugInfo);
DPV1->setMarker(FirstInst->DbgMarker);
DILocalVariable *DLV1 = DPV1->getVariable();
>From 44843704535363b1bb0e5af95415e3d4f852075f Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Fri, 23 Feb 2024 09:47:16 +0000
Subject: [PATCH 3/4] Rebase fixes, move validateDbgValues into verifier
---
llvm/include/llvm/IR/BasicBlock.h | 9 -----
llvm/lib/IR/BasicBlock.cpp | 61 -------------------------------
llvm/lib/IR/Verifier.cpp | 14 +++----
3 files changed, 7 insertions(+), 77 deletions(-)
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index ed25cb96ae9645..179305e9260f91 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -93,15 +93,6 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// if necessary.
void setIsNewDbgInfoFormat(bool NewFlag);
- /// Validate any DPMarkers / DPValues attached to instructions in this block,
- /// and block-level stored data too (TrailingDPValues).
- /// \p Assert Should this method fire an assertion if a problem is found?
- /// \p Msg Should this method print a message to errs() if a problem is found?
- /// \p OS Output stream to write errors to.
- /// \returns True if a problem is found.
- bool validateDbgValues(bool Assert = true, bool Msg = false,
- raw_ostream *OS = nullptr);
-
/// Record that the collection of DPValues in \p M "trails" after the last
/// instruction of this block. These are equivalent to dbg.value intrinsics
/// that exist at the end of a basic block with no terminator (a transient
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index c110c4c1437c30..25aa3261164513 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -122,67 +122,6 @@ void BasicBlock::convertFromNewDbgValues() {
assert(!getTrailingDPValues());
}
-bool BasicBlock::validateDbgValues(bool Assert, bool Msg, raw_ostream *OS) {
- bool RetVal = false;
- if (!OS)
- OS = &errs();
-
- // Helper lambda for reporting failures: via assertion, printing, and return
- // value.
- auto TestFailure = [Assert, Msg, &RetVal, OS](bool Val, const char *Text) {
- // Did the test fail?
- if (Val)
- return;
-
- // If we're asserting, then fire off an assertion.
- if (Assert)
- llvm_unreachable(Text);
-
- if (Msg)
- *OS << Text << "\n";
- RetVal = true;
- };
-
- // We should have the same debug-format as the parent function.
- TestFailure(getParent()->IsNewDbgInfoFormat == IsNewDbgInfoFormat,
- "Parent function doesn't have the same debug-info format");
-
- // Only validate if we are using the new format.
- if (!IsNewDbgInfoFormat)
- return RetVal;
-
- // Match every DPMarker to every Instruction and vice versa, and
- // verify that there are no invalid DPValues.
- for (auto It = begin(); It != end(); ++It) {
- if (!It->DbgMarker)
- continue;
-
- // Validate DebugProgramMarkers.
- DPMarker *CurrentDebugMarker = It->DbgMarker;
-
- // If this is a marker, it should match the instruction and vice versa.
- TestFailure(CurrentDebugMarker->MarkedInstr == &*It,
- "Debug Marker points to incorrect instruction?");
-
- // Now validate any DPValues in the marker.
- for (DbgRecord &DPR : CurrentDebugMarker->getDbgValueRange()) {
- // Validate DebugProgramValues.
- TestFailure(DPR.getMarker() == CurrentDebugMarker,
- "Not pointing at correct next marker!");
-
- // Verify that no DbgValues appear prior to PHIs.
- TestFailure(
- !isa<PHINode>(It),
- "DebugProgramValues must not appear before PHI nodes in a block!");
- }
- }
-
- // Except transiently when removing + re-inserting the block terminator, there
- // should be no trailing DPValues.
- TestFailure(!getTrailingDPValues(), "Trailing DPValues in block");
- return RetVal;
-}
-
#ifndef NDEBUG
void BasicBlock::dumpDbgValues() const {
for (auto &Inst : *this) {
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 67ccda9cb0612d..4299185146855d 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -173,6 +173,11 @@ struct VerifierSupport {
}
}
+ void Write(const DbgRecord *DR) {
+ if (DR)
+ DR->print(*OS, MST, false);
+ }
+
void Write(const DPValue *V) {
if (V)
V->print(*OS, MST, false);
@@ -676,7 +681,7 @@ void Verifier::visitDbgRecords(Instruction &I) {
return;
CheckDI(I.DbgMarker->MarkedInstr == &I, "Instruction has invalid DbgMarker", &I);
CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(), "PHI Node must not have any attached DbgRecords", &I);
- for (auto &DPV : I.getDbgValueRange()) {
+ for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) {
CheckDI(DPV.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker", &I, &DPV);
visit(DPV);
}
@@ -3010,13 +3015,8 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
}
// Confirm that no issues arise from the debug program.
- if (BB.IsNewDbgInfoFormat) {
+ if (BB.IsNewDbgInfoFormat)
CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!", &BB);
- // Configure the validate function to not fire assertions, instead print
- // errors and return true if there's a problem.
- bool RetVal = BB.validateDbgValues(false, true, OS);
- Check(!RetVal, "Invalid configuration of new-debug-info data found");
- }
}
void Verifier::visitTerminator(Instruction &I) {
>From 52af23e2ebe352d2fb2c69fef7812ec20a5c834d Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Tue, 27 Feb 2024 16:19:23 +0000
Subject: [PATCH 4/4] clang-format
---
llvm/lib/IR/Verifier.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4299185146855d..3741e5deaa4cd1 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -679,10 +679,13 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void Verifier::visitDbgRecords(Instruction &I) {
if (!I.DbgMarker)
return;
- CheckDI(I.DbgMarker->MarkedInstr == &I, "Instruction has invalid DbgMarker", &I);
- CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(), "PHI Node must not have any attached DbgRecords", &I);
+ CheckDI(I.DbgMarker->MarkedInstr == &I, "Instruction has invalid DbgMarker",
+ &I);
+ CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(),
+ "PHI Node must not have any attached DbgRecords", &I);
for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) {
- CheckDI(DPV.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker", &I, &DPV);
+ CheckDI(DPV.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker",
+ &I, &DPV);
visit(DPV);
}
}
@@ -3016,7 +3019,8 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
// Confirm that no issues arise from the debug program.
if (BB.IsNewDbgInfoFormat)
- CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!", &BB);
+ CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!",
+ &BB);
}
void Verifier::visitTerminator(Instruction &I) {
More information about the llvm-commits
mailing list