aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorArtem Pianykh <artem.pyanykh@gmail.com>2025-03-16 11:25:42 +0000
committerGitHub <noreply@github.com>2025-03-16 11:25:42 +0000
commitdc9a183ac6aa2d087ceac56970255b06c4772ca3 (patch)
treecc124bac386abfef40cd8972cf6b6231ca6d5315 /llvm/lib/Transforms/Utils/CloneFunction.cpp
parent926d980017d82dedb9eb50147a82fdfb01659f16 (diff)
downloadllvm-dc9a183ac6aa2d087ceac56970255b06c4772ca3.zip
llvm-dc9a183ac6aa2d087ceac56970255b06c4772ca3.tar.gz
llvm-dc9a183ac6aa2d087ceac56970255b06c4772ca3.tar.bz2
[NFC][Cloning] Move DebugInfoFinder decl closer to its place of usage (#129154)
Summary: This makes it clear that DIFinder is only really necessary for llvm.dbg.cu update. Test Plan: ninja check-llvm-unit
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index cde1ce8..b411d4c 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -266,8 +266,6 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
if (OldFunc->isDeclaration())
return;
- DebugInfoFinder DIFinder;
-
if (Changes < CloneFunctionChangeType::DifferentModule) {
assert((NewFunc->getParent() == nullptr ||
NewFunc->getParent() == OldFunc->getParent()) &&
@@ -320,7 +318,8 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
Visited.insert(Operand);
// Collect and clone all the compile units referenced from the instructions in
- // the function (e.g. as a scope).
+ // the function (e.g. as instructions' scope).
+ DebugInfoFinder DIFinder;
collectDebugInfoFromInstructions(*OldFunc, DIFinder);
for (auto *Unit : DIFinder.compile_units()) {
MDNode *MappedUnit =