[llvm] 29129be - [NFC][Cloning] Add a helper to collect debug info from instructions (#129145)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 9 11:35:47 PDT 2025
Author: Artem Pianykh
Date: 2025-03-09T18:35:42Z
New Revision: 29129be6322375a296a3540a5ed64d87ee0aac9a
URL: https://github.com/llvm/llvm-project/commit/29129be6322375a296a3540a5ed64d87ee0aac9a
DIFF: https://github.com/llvm/llvm-project/commit/29129be6322375a296a3540a5ed64d87ee0aac9a.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Utils/CloneFunction.cpp
Removed:
################################################################################
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;
}
More information about the llvm-commits
mailing list