https://github.com/artempyanykh updated https://github.com/llvm/llvm-project/pull/129145
>From 181b126bed444ea0a24799f32be75fc2f62e260c Mon Sep 17 00:00:00 2001 From: Artem Pianykh <a...@fb.com> Date: Tue, 25 Feb 2025 10:03:41 -0800 Subject: [PATCH] [NFC][Cloning] Add a helper to collect debug info from instructions Summary: Just moving around. This helper will be used for further refactoring. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: https://github.com/llvm/llvm-project/pull/129145, branch: users/artempyanykh/fast-coro-upstream-part2-take2/3 --- llvm/lib/Transforms/Utils/CloneFunction.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 7a309f7390c77..e03c5c27b5ac1 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; } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits