[PATCH] D75213: RFC: More principled implementation of DISubprogram::describes()
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 10:21:16 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c83bedecab9: More principled implementation of DISubprogram::describes() (authored by aprantl).
Changed prior to commit:
https://reviews.llvm.org/D75213?vs=246835&id=247687#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75213/new/
https://reviews.llvm.org/D75213
Files:
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/disubprogram-name-match-only.ll
Index: llvm/test/Verifier/disubprogram-name-match-only.ll
===================================================================
--- /dev/null
+++ llvm/test/Verifier/disubprogram-name-match-only.ll
@@ -0,0 +1,26 @@
+; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
+
+define void @f() !dbg !14 {
+ ret void, !dbg !5
+}
+
+!llvm.module.flags = !{!15}
+!llvm.dbg.cu = !{!4}
+
+!0 = !{null}
+!1 = distinct !DICompositeType(tag: DW_TAG_structure_type)
+!2 = !DIFile(filename: "f.c", directory: "/")
+!3 = !DISubroutineType(types: !0)
+!4 = distinct !DICompileUnit(language: DW_LANG_C, file: !2)
+; CHECK: !dbg attachment points at wrong subprogram for function
+; CHECK: warning: ignoring invalid debug info
+!5 = !DILocation(line: 1, scope: !9)
+!9 = distinct !DISubprogram(name: "f", scope: !1,
+ file: !2, line: 1, type: !3, isLocal: true,
+ isDefinition: true, scopeLine: 2,
+ unit: !4)
+!14 = distinct !DISubprogram(name: "f", scope: !1,
+ file: !2, line: 1, type: !3, isLocal: true,
+ isDefinition: true, scopeLine: 2,
+ unit: !4)
+!15 = !{i32 1, !"Debug Info Version", i32 3}
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -2364,8 +2364,7 @@
if (!HasDebugInfo)
return;
- // Check that all !dbg attachments lead to back to N (or, at least, another
- // subprogram that describes the same function).
+ // Check that all !dbg attachments lead to back to N.
//
// FIXME: Check this incrementally while visiting !dbg attachments.
// FIXME: Only check when N is the canonical subprogram for F.
@@ -2394,11 +2393,9 @@
if (SP && ((Scope != SP) && !Seen.insert(SP).second))
return;
- // FIXME: Once N is canonical, check "SP == &N".
AssertDI(SP->describes(&F),
"!dbg attachment points at wrong subprogram for function", N, &F,
&I, DL, Scope, SP);
- visitMDNode(*SP);
};
for (auto &BB : F)
for (auto &I : BB) {
Index: llvm/lib/IR/DebugInfoMetadata.cpp
===================================================================
--- llvm/lib/IR/DebugInfoMetadata.cpp
+++ llvm/lib/IR/DebugInfoMetadata.cpp
@@ -660,12 +660,7 @@
bool DISubprogram::describes(const Function *F) const {
assert(F && "Invalid function");
- if (F->getSubprogram() == this)
- return true;
- StringRef Name = getLinkageName();
- if (Name.empty())
- Name = getName();
- return F->getName() == Name;
+ return F->getSubprogram() == this;
}
DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75213.247687.patch
Type: text/x-patch
Size: 2760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200302/5a9b75ed/attachment.bin>
More information about the llvm-commits
mailing list