summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/IRMover.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Linker/IRMover.cpp')
-rw-r--r--llvm/lib/Linker/IRMover.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e737f7412d1..f30b623b523 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1205,14 +1205,16 @@ void IRLinker::findNeededSubprograms() {
assert(CU && "Expected valid compile unit");
// Ensure that we don't remove subprograms referenced by DIImportedEntity.
// It is not legal to have a DIImportedEntity with a null entity or scope.
+ // Using getDISubprogram handles the case where the subprogram is reached
+ // via an intervening DILexicalBlock.
// FIXME: The DISubprogram for functions not linked in but kept due to
// being referenced by a DIImportedEntity should also get their
// IsDefinition flag is unset.
SmallPtrSet<DISubprogram *, 8> ImportedEntitySPs;
for (auto *IE : CU->getImportedEntities()) {
- if (auto *SP = dyn_cast<DISubprogram>(IE->getEntity()))
+ if (auto *SP = getDISubprogram(dyn_cast<MDNode>(IE->getEntity())))
ImportedEntitySPs.insert(SP);
- if (auto *SP = dyn_cast<DISubprogram>(IE->getScope()))
+ if (auto *SP = getDISubprogram(dyn_cast<MDNode>(IE->getScope())))
ImportedEntitySPs.insert(SP);
}
for (auto *Op : CU->getSubprograms()) {
OpenPOWER on IntegriCloud