[llvm] [RemoveDIs] Add additional debug-mode verifier checks (PR #84308)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 03:28:27 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Orlando Cazalet-Hyams (OCHyams)

<details>
<summary>Changes</summary>

Separated from #<!-- -->83251

---
Full diff: https://github.com/llvm/llvm-project/pull/84308.diff


1 Files Affected:

- (modified) llvm/lib/IR/Verifier.cpp (+10) 


``````````diff
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index e0de179e57146f..e6e617cc40cb2d 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2674,6 +2674,11 @@ void Verifier::visitFunction(const Function &F) {
   Check(verifyAttributeCount(Attrs, FT->getNumParams()),
         "Attribute after last parameter!", &F);
 
+  Check(F.IsNewDbgInfoFormat == F.getParent()->IsNewDbgInfoFormat,
+        "Fn debug format should match parent", &F,
+        F.IsNewDbgInfoFormat, F.getParent(),
+        F.getParent()->IsNewDbgInfoFormat);
+
   bool IsIntrinsic = F.isIntrinsic();
 
   // Check function attributes.
@@ -3017,6 +3022,11 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
     Check(I.getParent() == &BB, "Instruction has bogus parent pointer!");
   }
 
+  Check(BB.IsNewDbgInfoFormat == BB.getParent()->IsNewDbgInfoFormat,
+        "BB debug format should match parent", &BB,
+        BB.IsNewDbgInfoFormat, BB.getParent(),
+        BB.getParent()->IsNewDbgInfoFormat);
+
   // Confirm that no issues arise from the debug program.
   if (BB.IsNewDbgInfoFormat)
     CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!",

``````````

</details>


https://github.com/llvm/llvm-project/pull/84308


More information about the llvm-commits mailing list