[llvm] [RemoveDIs][DebugInfo] Verifier and printing fixes for DPLabel (PR #83242)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 28 04:44:45 PST 2024
================
@@ -6187,6 +6195,34 @@ static DISubprogram *getSubprogram(Metadata *LocalScope) {
return nullptr;
}
+void Verifier::visit(DPLabel &DPL) {
+ CheckDI(isa<DILabel>(DPL.getRawLabel()),
+ "invalid #dbg_label intrinsic variable", &DPL, DPL.getRawLabel());
+
+ // Ignore broken !dbg attachments; they're checked elsewhere.
+ if (MDNode *N = DPL.getDebugLoc().getAsMDNode())
+ if (!isa<DILocation>(N))
+ return;
+
+ BasicBlock *BB = DPL.getParent();
+ Function *F = BB ? BB->getParent() : nullptr;
+
+ // The scopes for variables and !dbg attachments must agree.
+ DILabel *Label = DPL.getLabel();
+ DILocation *Loc = DPL.getDebugLoc();
+ Check(Loc, "#dbg_label record requires a !dbg attachment", &DPL, BB, F);
----------------
SLTozer wrote:
Simply because the same check for `llvm.dbg.label` is also a `Check` - no reason we can't change that here, of course!
https://github.com/llvm/llvm-project/pull/83242
More information about the llvm-commits
mailing list