aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorArtem Pianykh <artem.pyanykh@gmail.com>2025-03-09 15:49:04 +0000
committerGitHub <noreply@github.com>2025-03-09 15:49:04 +0000
commit7c4ef498e1e41ed80f8553a955145b6580918f7c (patch)
treef8ae94eb198096c2886b5eac79d916a62f4623bf /llvm/lib/Transforms/Utils/CloneFunction.cpp
parent3a727549ef963d13efc3d1466318bfcf838377e7 (diff)
downloadllvm-7c4ef498e1e41ed80f8553a955145b6580918f7c.zip
llvm-7c4ef498e1e41ed80f8553a955145b6580918f7c.tar.gz
llvm-7c4ef498e1e41ed80f8553a955145b6580918f7c.tar.bz2
[NFC][Cloning] Make ClonedModule case more obvious in CollectDebugInfoForCloning (#129143)
Summary: The code's behavior is unchanged, but it's more obvious right now. 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.cpp6
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);