[PATCH] D75213: RFC: More principled implementation of DISubprogram::describes()

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 14:38:50 PST 2020


aprantl created this revision.
aprantl added reviewers: vsk, dexonsmith, dblaikie.
aprantl added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
aprantl added a parent revision: D75212: Visit previously unreachable nodes in the debug info metadata verifier..

  commit 3c2d70434bd750683baa94432bfe9fd1f639f968
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   Mon Apr 13 19:07:27 2015 +0000
  
      DebugInfo: Migrate DISubprogram::describes() to new hierarchy, NFC
      
      I don't really like this function at all -- I think it should be as
      simple as `return getFunction() == F` -- but for now this seems like the
      best we can do.
      
      llvm-svn: 234778

I'm not sure if we still need the name check. Perhaps there are some LTO cases where this is necessary but it's not clear to me what they are.


https://reviews.llvm.org/D75213

Files:
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/Verifier.cpp


Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -2398,7 +2398,6 @@
     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.246835.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200226/b2cc3171/attachment.bin>


More information about the llvm-commits mailing list