diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 58d400a..9267930 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -135,6 +135,10 @@ void llvm::CloneFunctionAttributesInto(Function *NewFunc, DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F, CloneFunctionChangeType Changes, DebugInfoFinder &DIFinder) { + // CloneModule takes care of cloning debug info. + if (Changes == CloneFunctionChangeType::ClonedModule) + return nullptr; + DISubprogram *SPClonedWithinModule = nullptr; if (Changes < CloneFunctionChangeType::DifferentModule) { SPClonedWithinModule = F.getSubprogram(); @@ -143,7 +147,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F, DIFinder.processSubprogram(SPClonedWithinModule); const Module *M = F.getParent(); - if (Changes != CloneFunctionChangeType::ClonedModule && M) { + if (M) { // Inspect instructions to process e.g. DILexicalBlocks of inlined functions for (const auto &I : instructions(F)) DIFinder.processInstruction(*M, I); |