summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-01-25 21:29:55 +0000
committerTeresa Johnson <tejohnson@google.com>2016-01-25 21:29:55 +0000
commitf07db00a656e3bf08c6da4f3e46bae4f82bd56b2 (patch)
treefef0031075464e423e3b55105c2964c06bf6b081 /llvm/lib/Linker
parentd851833c9a76c267824cd58c155dd660546f59b1 (diff)
downloadbcm5719-llvm-f07db00a656e3bf08c6da4f3e46bae4f82bd56b2.tar.gz
bcm5719-llvm-f07db00a656e3bf08c6da4f3e46bae4f82bd56b2.zip
[ThinLTO] Handle DISubprogram reached indirectly from DIImportedEntity
Extend fix for PR26037 to identify DISubprogram reached from a DIImportedEntity via a DILexicalBlock. llvm-svn: 258722
Diffstat (limited to 'llvm/lib/Linker')
-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