Skip to content

Commit 1eaaeec

Browse files
committed
[NFC][Utils] Remove DebugInfoFinder parameter from CloneBasicBlock
Summary: There was a single usage of CloneBasicBlock with non-default DebugInfoFinder inside CloneFunctionInto which has been refactored in more focused. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: llvm/llvm-project#118620, branch: users/artempyanykh/fast-coro-upstream/1
1 parent 6a0d6fc commit 1eaaeec

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ struct ClonedCodeInfo {
119119
/// parameter.
120120
BasicBlock *CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
121121
const Twine &NameSuffix = "", Function *F = nullptr,
122-
ClonedCodeInfo *CodeInfo = nullptr,
123-
DebugInfoFinder *DIFinder = nullptr);
122+
ClonedCodeInfo *CodeInfo = nullptr);
124123

125124
/// Return a copy of the specified function and add it to that
126125
/// function's module. Also, any references specified in the VMap are changed

llvm/lib/Transforms/Utils/CloneFunction.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,16 @@ using namespace llvm;
4343
/// See comments in Cloning.h.
4444
BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
4545
const Twine &NameSuffix, Function *F,
46-
ClonedCodeInfo *CodeInfo,
47-
DebugInfoFinder *DIFinder) {
46+
ClonedCodeInfo *CodeInfo) {
4847
BasicBlock *NewBB = BasicBlock::Create(BB->getContext(), "", F);
4948
NewBB->IsNewDbgInfoFormat = BB->IsNewDbgInfoFormat;
5049
if (BB->hasName())
5150
NewBB->setName(BB->getName() + NameSuffix);
5251

5352
bool hasCalls = false, hasDynamicAllocas = false, hasMemProfMetadata = false;
54-
Module *TheModule = F ? F->getParent() : nullptr;
5553

5654
// Loop over all instructions, and copy them over.
5755
for (const Instruction &I : *BB) {
58-
if (DIFinder && TheModule)
59-
DIFinder->processInstruction(*TheModule, I);
60-
6156
Instruction *NewInst = I.clone();
6257
if (I.hasName())
6358
NewInst->setName(I.getName() + NameSuffix);
@@ -221,10 +216,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
221216
for (const BasicBlock &BB : *OldFunc) {
222217

223218
// Create a new basic block and copy instructions into it!
224-
// NOTE: don't pass DIFinder because instructions' debug info was processed
225-
// in ProcessSubprogramAttachment. This will be cleaned up further.
226-
BasicBlock *CBB =
227-
CloneBasicBlock(&BB, VMap, NameSuffix, NewFunc, CodeInfo, nullptr);
219+
BasicBlock *CBB = CloneBasicBlock(&BB, VMap, NameSuffix, NewFunc, CodeInfo);
228220

229221
// Add basic block mapping.
230222
VMap[&BB] = CBB;

0 commit comments

Comments
 (0)