[llvm] 8876220 - [ExecutionEngine] Remove unused functions
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 00:24:56 PDT 2023
Author: Kazu Hirata
Date: 2023-06-13T00:24:38-07:00
New Revision: 8876220948e6a63c2d5f1121c769d5524125d542
URL: https://github.com/llvm/llvm-project/commit/8876220948e6a63c2d5f1121c769d5524125d542
DIFF: https://github.com/llvm/llvm-project/commit/8876220948e6a63c2d5f1121c769d5524125d542.diff
LOG: [ExecutionEngine] Remove unused functions
This patch removes:
cloneModuleFlagsMetadata
moveFunctionBody
moveGlobalVariableInitializer
Their last uses were removed by:
commit 6154c4115cd4b78d0171892aac21e340e72e32bd
Author: Lang Hames <lhames at gmail.com>
Date: Mon Sep 7 21:21:28 2020 -0700
Differential Revision: https://reviews.llvm.org/D152668
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
index 71ece427be14b..3b9ba55ef9c4c 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
@@ -513,7 +513,7 @@ class SymbolLinkagePromoter {
/// Clone a function declaration into a new module.
///
/// This function can be used as the first step towards creating a callback
-/// stub (see makeStub), or moving a function body (see moveFunctionBody).
+/// stub (see makeStub).
///
/// If the VMap argument is non-null, a mapping will be added between F and
/// the new declaration, and between each of F's arguments and the new
@@ -525,43 +525,14 @@ class SymbolLinkagePromoter {
Function *cloneFunctionDecl(Module &Dst, const Function &F,
ValueToValueMapTy *VMap = nullptr);
-/// Move the body of function 'F' to a cloned function declaration in a
-///
diff erent module (See related cloneFunctionDecl).
-///
-/// If the target function declaration is not supplied via the NewF parameter
-/// then it will be looked up via the VMap.
-///
-/// This will delete the body of function 'F' from its original parent module,
-/// but leave its declaration.
-void moveFunctionBody(Function &OrigF, ValueToValueMapTy &VMap,
- ValueMaterializer *Materializer = nullptr,
- Function *NewF = nullptr);
-
/// Clone a global variable declaration into a new module.
GlobalVariable *cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV,
ValueToValueMapTy *VMap = nullptr);
-/// Move global variable GV from its parent module to cloned global
-/// declaration in a
diff erent module.
-///
-/// If the target global declaration is not supplied via the NewGV parameter
-/// then it will be looked up via the VMap.
-///
-/// This will delete the initializer of GV from its original parent module,
-/// but leave its declaration.
-void moveGlobalVariableInitializer(GlobalVariable &OrigGV,
- ValueToValueMapTy &VMap,
- ValueMaterializer *Materializer = nullptr,
- GlobalVariable *NewGV = nullptr);
-
/// Clone a global alias declaration into a new module.
GlobalAlias *cloneGlobalAliasDecl(Module &Dst, const GlobalAlias &OrigA,
ValueToValueMapTy &VMap);
-/// Clone module flags metadata into the destination module.
-void cloneModuleFlagsMetadata(Module &Dst, const Module &Src,
- ValueToValueMapTy &VMap);
-
/// Introduce relocations to \p Sym in its own definition if there are any
/// pointers formed via PC-relative address that do not already have a
/// relocation.
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
index 8f2537d343d35..a0d81cdf20867 100644
--- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
@@ -325,26 +325,6 @@ Function* cloneFunctionDecl(Module &Dst, const Function &F,
return NewF;
}
-void moveFunctionBody(Function &OrigF, ValueToValueMapTy &VMap,
- ValueMaterializer *Materializer,
- Function *NewF) {
- assert(!OrigF.isDeclaration() && "Nothing to move");
- if (!NewF)
- NewF = cast<Function>(VMap[&OrigF]);
- else
- assert(VMap[&OrigF] == NewF && "Incorrect function mapping in VMap.");
- assert(NewF && "Function mapping missing from VMap.");
- assert(NewF->getParent() != OrigF.getParent() &&
- "moveFunctionBody should only be used to move bodies between "
- "modules.");
-
- SmallVector<ReturnInst *, 8> Returns; // Ignore returns cloned.
- CloneFunctionInto(NewF, &OrigF, VMap,
- CloneFunctionChangeType::DifferentModule, Returns, "",
- nullptr, nullptr, Materializer);
- OrigF.deleteBody();
-}
-
GlobalVariable* cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV,
ValueToValueMapTy *VMap) {
GlobalVariable *NewGV = new GlobalVariable(
@@ -357,24 +337,6 @@ GlobalVariable* cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV,
return NewGV;
}
-void moveGlobalVariableInitializer(GlobalVariable &OrigGV,
- ValueToValueMapTy &VMap,
- ValueMaterializer *Materializer,
- GlobalVariable *NewGV) {
- assert(OrigGV.hasInitializer() && "Nothing to move");
- if (!NewGV)
- NewGV = cast<GlobalVariable>(VMap[&OrigGV]);
- else
- assert(VMap[&OrigGV] == NewGV &&
- "Incorrect global variable mapping in VMap.");
- assert(NewGV->getParent() != OrigGV.getParent() &&
- "moveGlobalVariableInitializer should only be used to move "
- "initializers between modules");
-
- NewGV->setInitializer(MapValue(OrigGV.getInitializer(), VMap, RF_None,
- nullptr, Materializer));
-}
-
GlobalAlias* cloneGlobalAliasDecl(Module &Dst, const GlobalAlias &OrigA,
ValueToValueMapTy &VMap) {
assert(OrigA.getAliasee() && "Original alias doesn't have an aliasee?");
@@ -386,15 +348,6 @@ GlobalAlias* cloneGlobalAliasDecl(Module &Dst, const GlobalAlias &OrigA,
return NewA;
}
-void cloneModuleFlagsMetadata(Module &Dst, const Module &Src,
- ValueToValueMapTy &VMap) {
- auto *MFs = Src.getModuleFlagsMetadata();
- if (!MFs)
- return;
- for (auto *MF : MFs->operands())
- Dst.addModuleFlag(MapMetadata(MF, VMap));
-}
-
Error addFunctionPointerRelocationsToCurrentSymbol(jitlink::Symbol &Sym,
jitlink::LinkGraph &G,
MCDisassembler &Disassembler,
More information about the llvm-commits
mailing list