diff options
author | Artem Pianykh <artem.pyanykh@gmail.com> | 2025-03-09 18:35:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-09 18:35:42 +0000 |
commit | 29129be6322375a296a3540a5ed64d87ee0aac9a (patch) | |
tree | f4fdfa4065e3114d7baf2ae5bc95a3a64598d590 /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | 437d587e48002929552d982c9e2dc73428a37dd9 (diff) | |
download | llvm-29129be6322375a296a3540a5ed64d87ee0aac9a.zip llvm-29129be6322375a296a3540a5ed64d87ee0aac9a.tar.gz llvm-29129be6322375a296a3540a5ed64d87ee0aac9a.tar.bz2 |
[NFC][Cloning] Add a helper to collect debug info from instructions (#129145)
Summary:
Just moving around. This helper will be used for further refactoring.
Test Plan:
ninja check-llvm-unit check-llvm
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 7a309f7..e03c5c2 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -40,6 +40,18 @@ using namespace llvm; #define DEBUG_TYPE "clone-function" +namespace { +void collectDebugInfoFromInstructions(const Function &F, + DebugInfoFinder &DIFinder) { + const Module *M = F.getParent(); + if (M) { + // Inspect instructions to process e.g. DILexicalBlocks of inlined functions + for (const auto &I : instructions(F)) + DIFinder.processInstruction(*M, I); + } +} +} // namespace + /// See comments in Cloning.h. BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap, const Twine &NameSuffix, Function *F, @@ -146,12 +158,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F, if (SPClonedWithinModule) DIFinder.processSubprogram(SPClonedWithinModule); - const Module *M = F.getParent(); - if (M) { - // Inspect instructions to process e.g. DILexicalBlocks of inlined functions - for (const auto &I : instructions(F)) - DIFinder.processInstruction(*M, I); - } + collectDebugInfoFromInstructions(F, DIFinder); return SPClonedWithinModule; } |