[llvm] [NFC][Utils] Remove DebugInfoFinder parameter from CloneBasicBlock (PR #118620)
Artem Pianykh via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 05:15:24 PST 2024
https://github.com/artempyanykh created https://github.com/llvm/llvm-project/pull/118620
[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
>From 7359c16688d1d6a6b3c257de8006d762e66e76ae Mon Sep 17 00:00:00 2001
From: Artem Pianykh <arr at fb.com>
Date: Thu, 12 Sep 2024 15:01:05 -0700
Subject: [PATCH] [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
---
llvm/include/llvm/Transforms/Utils/Cloning.h | 3 +--
llvm/lib/Transforms/Utils/CloneFunction.cpp | 12 ++----------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h
index 049d68b8a30681..3c8f2cbfaa9b81 100644
--- a/llvm/include/llvm/Transforms/Utils/Cloning.h
+++ b/llvm/include/llvm/Transforms/Utils/Cloning.h
@@ -119,8 +119,7 @@ struct ClonedCodeInfo {
/// parameter.
BasicBlock *CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
const Twine &NameSuffix = "", Function *F = nullptr,
- ClonedCodeInfo *CodeInfo = nullptr,
- DebugInfoFinder *DIFinder = nullptr);
+ ClonedCodeInfo *CodeInfo = nullptr);
/// Return a copy of the specified function and add it to that
/// function's module. Also, any references specified in the VMap are changed
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index cb6a4e34c226e5..b55776d736e663 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -43,21 +43,16 @@ using namespace llvm;
/// See comments in Cloning.h.
BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
const Twine &NameSuffix, Function *F,
- ClonedCodeInfo *CodeInfo,
- DebugInfoFinder *DIFinder) {
+ ClonedCodeInfo *CodeInfo) {
BasicBlock *NewBB = BasicBlock::Create(BB->getContext(), "", F);
NewBB->IsNewDbgInfoFormat = BB->IsNewDbgInfoFormat;
if (BB->hasName())
NewBB->setName(BB->getName() + NameSuffix);
bool hasCalls = false, hasDynamicAllocas = false, hasMemProfMetadata = false;
- Module *TheModule = F ? F->getParent() : nullptr;
// Loop over all instructions, and copy them over.
for (const Instruction &I : *BB) {
- if (DIFinder && TheModule)
- DIFinder->processInstruction(*TheModule, I);
-
Instruction *NewInst = I.clone();
if (I.hasName())
NewInst->setName(I.getName() + NameSuffix);
@@ -221,10 +216,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
for (const BasicBlock &BB : *OldFunc) {
// Create a new basic block and copy instructions into it!
- // NOTE: don't pass DIFinder because instructions' debug info was processed
- // in ProcessSubprogramAttachment. This will be cleaned up further.
- BasicBlock *CBB =
- CloneBasicBlock(&BB, VMap, NameSuffix, NewFunc, CodeInfo, nullptr);
+ BasicBlock *CBB = CloneBasicBlock(&BB, VMap, NameSuffix, NewFunc, CodeInfo);
// Add basic block mapping.
VMap[&BB] = CBB;
More information about the llvm-commits
mailing list