Skip to content

Commit 7c4ef49

Browse files
authored
[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
1 parent 3a72754 commit 7c4ef49

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: llvm/lib/Transforms/Utils/CloneFunction.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ void llvm::CloneFunctionAttributesInto(Function *NewFunc,
135135
DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
136136
CloneFunctionChangeType Changes,
137137
DebugInfoFinder &DIFinder) {
138+
// CloneModule takes care of cloning debug info.
139+
if (Changes == CloneFunctionChangeType::ClonedModule)
140+
return nullptr;
141+
138142
DISubprogram *SPClonedWithinModule = nullptr;
139143
if (Changes < CloneFunctionChangeType::DifferentModule) {
140144
SPClonedWithinModule = F.getSubprogram();
@@ -143,7 +147,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
143147
DIFinder.processSubprogram(SPClonedWithinModule);
144148

145149
const Module *M = F.getParent();
146-
if (Changes != CloneFunctionChangeType::ClonedModule && M) {
150+
if (M) {
147151
// Inspect instructions to process e.g. DILexicalBlocks of inlined functions
148152
for (const auto &I : instructions(F))
149153
DIFinder.processInstruction(*M, I);

0 commit comments

Comments
 (0)