diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/StripSymbols.cpp | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 4fe2553687c..c5d39c54430 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -79,9 +79,19 @@ void DebugInfoFinder::processModule(const Module &M) { processScope(M->getScope()); } } - for (auto &F : M.functions()) + for (auto &F : M.functions()) { if (auto *SP = cast_or_null<DISubprogram>(F.getSubprogram())) processSubprogram(SP); + // There could be subprograms from inlined functions referenced from + // instructions only. Walk the function to find them. + for (const BasicBlock &BB : F) { + for (const Instruction &I : BB) { + if (!I.getDebugLoc()) + continue; + processLocation(M, I.getDebugLoc().get()); + } + } + } } void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) { diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index 4d52f5f3110..fb64367eef9 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -324,10 +324,9 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { } std::set<DICompileUnit *> LiveCUs; - // Any CU referenced from a function is live. - for (Function &F : M.functions()) { - DISubprogram *SP = F.getSubprogram(); - if (SP && SP->getUnit()) + // Any CU referenced from a subprogram is live. + for (DISubprogram *SP : F.subprograms()) { + if (SP->getUnit()) LiveCUs.insert(SP->getUnit()); } |

