[PATCH] D66187: [DebugInfo] Consider debug label scope has an extra lexical block file

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 10:58:31 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL368891: [DebugInfo] Consider debug label scope has an extra lexical block file (authored by twoh, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66187?vs=214973&id=215172#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66187/new/

https://reviews.llvm.org/D66187

Files:
  llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/trunk/test/DebugInfo/Generic/debug-label.ll


Index: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1603,11 +1603,14 @@
 
     LexicalScope *Scope = nullptr;
     const DILabel *Label = cast<DILabel>(IL.first);
+    // The scope could have an extra lexical block file.
+    const DILocalScope *LocalScope =
+        Label->getScope()->getNonLexicalBlockFileScope();
     // Get inlined DILocation if it is inlined label.
     if (const DILocation *IA = IL.second)
-      Scope = LScopes.findInlinedScope(Label->getScope(), IA);
+      Scope = LScopes.findInlinedScope(LocalScope, IA);
     else
-      Scope = LScopes.findLexicalScope(Label->getScope());
+      Scope = LScopes.findLexicalScope(LocalScope);
     // If label scope is not found then skip this label.
     if (!Scope)
       continue;
Index: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -910,7 +910,8 @@
   OS << "DEBUG_LABEL: ";
 
   const DILabel *V = MI->getDebugLabel();
-  if (auto *SP = dyn_cast<DISubprogram>(V->getScope())) {
+  if (auto *SP = dyn_cast<DISubprogram>(
+          V->getScope()->getNonLexicalBlockFileScope())) {
     StringRef Name = SP->getName();
     if (!Name.empty())
       OS << Name << ":";
Index: llvm/trunk/test/DebugInfo/Generic/debug-label.ll
===================================================================
--- llvm/trunk/test/DebugInfo/Generic/debug-label.ll
+++ llvm/trunk/test/DebugInfo/Generic/debug-label.ll
@@ -70,6 +70,7 @@
 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
 !10 = !DILabel(scope: !6, name: "top", file: !1, line: 4)
 !11 = !DILocation(line: 4, column: 1, scope: !6)
-!12 = !DILabel(scope: !6, name: "done", file: !1, line: 7)
+!12 = !DILabel(scope: !15, name: "done", file: !1, line: 7)
 !13 = !DILocation(line: 7, column: 1, scope: !6)
 !14 = !DILocation(line: 8, column: 3, scope: !6)
+!15 = !DILexicalBlockFile(discriminator: 2, file: !1, scope: !6)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66187.215172.patch
Type: text/x-patch
Size: 2214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190814/f774e6d3/attachment.bin>


More information about the llvm-commits mailing list