Skip to content

Commit e70ed59

Browse files
committed
amend! [Utils] Extract CollectDebugInfoForCloning from CloneFunctionInto
1 parent b600fb4 commit e70ed59

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

llvm/include/llvm/Transforms/Utils/Cloning.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,19 @@ void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
207207
const char *NameSuffix = "",
208208
ClonedCodeInfo *CodeInfo = nullptr);
209209

210-
/// Process function's subprogram attachment to collect relevant debug
211-
/// information in DIFinder.
210+
/// Collect debug information such as types, compile units, and other
211+
/// subprograms that are reachable from \p F and can be considered global for
212+
/// the purposes of cloning (and hence not needing to be cloned).
213+
///
214+
/// The latter depends on \p Changes: when cloning into the same module we
215+
/// process \p F's subprogram and instructions; when into a cloned module,
216+
/// neither of those.
212217
///
213218
/// Returns DISubprogram of the cloned function when cloning into the same
214219
/// module or nullptr otherwise.
215-
DISubprogram *ProcessSubprogramAttachment(const Function &F,
216-
CloneFunctionChangeType Changes,
217-
DebugInfoFinder &DIFinder);
220+
DISubprogram *CollectDebugInfoForCloning(const Function &F,
221+
CloneFunctionChangeType Changes,
222+
DebugInfoFinder &DIFinder);
218223

219224
/// This class captures the data input to the InlineFunction call, and records
220225
/// the auxiliary results produced by it.

llvm/lib/Transforms/Utils/CloneFunction.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ void llvm::CloneFunctionAttributesInto(Function *NewFunc,
137137
OldAttrs.getRetAttrs(), NewArgAttrs));
138138
}
139139

140-
DISubprogram *llvm::ProcessSubprogramAttachment(const Function &F,
141-
CloneFunctionChangeType Changes,
142-
DebugInfoFinder &DIFinder) {
140+
DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
141+
CloneFunctionChangeType Changes,
142+
DebugInfoFinder &DIFinder) {
143143
DISubprogram *SPClonedWithinModule = nullptr;
144144
if (Changes < CloneFunctionChangeType::DifferentModule) {
145145
SPClonedWithinModule = F.getSubprogram();
@@ -213,7 +213,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
213213
}
214214

215215
DISubprogram *SPClonedWithinModule =
216-
ProcessSubprogramAttachment(*OldFunc, Changes, DIFinder);
216+
CollectDebugInfoForCloning(*OldFunc, Changes, DIFinder);
217217

218218
// Loop over all of the basic blocks in the function, cloning them as
219219
// appropriate. Note that we save BE this way in order to handle cloning of

0 commit comments

Comments
 (0)