summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorTaewook Oh <twoh@fb.com>2019-08-14 17:58:45 +0000
committerTaewook Oh <twoh@fb.com>2019-08-14 17:58:45 +0000
commitdf7022825c0e803efce34f11a3670b469c2901e0 (patch)
tree4d7135a32664fda1e2462b424a514d089f042d09 /llvm/lib/CodeGen
parent12f5a2807ef4dc8c82be29586a067aafa8aa41f4 (diff)
downloadbcm5719-llvm-df7022825c0e803efce34f11a3670b469c2901e0.tar.gz
bcm5719-llvm-df7022825c0e803efce34f11a3670b469c2901e0.zip
[DebugInfo] Consider debug label scope has an extra lexical block file
Summary: There are places where a case that debug label scope has an extra lexical block file is not considered properly. The modified test won't pass without this patch. Reviewers: aprantl, HsiangKai Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66187 llvm-svn: 368891
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp3
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp7
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 61cb46cb4bb..0319f256c6e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -910,7 +910,8 @@ static bool emitDebugLabelComment(const MachineInstr *MI, AsmPrinter &AP) {
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 << ":";
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index bfde1cf626c..d828c9097e9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1603,11 +1603,14 @@ void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU,
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;
OpenPOWER on IntegriCloud