[llvm] 5baaf0c - [ORC] Remove redundant ExecutorAddr temporaries.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 31 20:41:39 PDT 2023
Author: Lang Hames
Date: 2023-03-31T20:41:31-07:00
New Revision: 5baaf0c23e467af1d9b5eb4a995c543dc1796953
URL: https://github.com/llvm/llvm-project/commit/5baaf0c23e467af1d9b5eb4a995c543dc1796953
DIFF: https://github.com/llvm/llvm-project/commit/5baaf0c23e467af1d9b5eb4a995c543dc1796953.diff
LOG: [ORC] Remove redundant ExecutorAddr temporaries.
Most ORC APIs work with ExecutorAddr by default since 8b1771bd9f3, so we don't
need to wrap these values in ExecutorAddr(...) calls any more.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
index 6910fda712e57..c08476a916704 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
@@ -613,7 +613,7 @@ void COFFPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult,
void operator()(Expected<SymbolMap> Result) {
if (Result) {
assert(Result->size() == 1 && "Unexpected result map count");
- SendResult(ExecutorAddr(Result->begin()->second.getAddress()));
+ SendResult(Result->begin()->second.getAddress());
} else {
SendResult(Result.takeError());
}
@@ -892,8 +892,7 @@ Error COFFPlatform::COFFPlatformPlugin::
continue;
for (auto &E : B->edges())
BState.Initializers.push_back(std::make_pair(
- S.getName().str(),
- ExecutorAddr(E.getTarget().getAddress() + E.getAddend())));
+ S.getName().str(), E.getTarget().getAddress() + E.getAddend()));
}
return Error::success();
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index 9e99fa1d7b521..1ea700cb91843 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1000,7 +1000,7 @@ Error JITDylib::resolve(MaterializationResponsibility &MR,
// Resolved symbols can not be weak: discard the weak flag.
JITSymbolFlags ResolvedFlags = ResolvedSym.getFlags();
- SymI->second.setAddress(ExecutorAddr(ResolvedSym.getAddress()));
+ SymI->second.setAddress(ResolvedSym.getAddress());
SymI->second.setFlags(ResolvedFlags);
SymI->second.setState(SymbolState::Resolved);
diff --git a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
index ab2f7a139a70c..0446fa66aca2f 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp
@@ -166,8 +166,7 @@ void DebugObject::finalizeAsync(FinalizeContinuation OnFinalize) {
if (auto SimpleSegAlloc = finalizeWorkingMemory()) {
auto ROSeg = SimpleSegAlloc->getSegInfo(MemProt::Read);
- ExecutorAddrRange DebugObjRange(ExecutorAddr(ROSeg.Addr),
- ExecutorAddrDiff(ROSeg.WorkingMem.size()));
+ ExecutorAddrRange DebugObjRange(ROSeg.Addr, ROSeg.WorkingMem.size());
SimpleSegAlloc->finalize(
[this, DebugObjRange,
OnFinalize = std::move(OnFinalize)](Expected<FinalizedAlloc> FA) {
diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
index 6128cfe9fea7d..ce47c87ff81b8 100644
--- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
@@ -593,8 +593,7 @@ Error ELFNixPlatform::registerInitInfo(
for (auto *Sec : InitSections) {
// FIXME: Avoid copy here.
jitlink::SectionRange R(*Sec);
- InitSeq->InitSections[Sec->getName()].push_back(
- {ExecutorAddr(R.getStart()), ExecutorAddr(R.getEnd())});
+ InitSeq->InitSections[Sec->getName()].push_back({R.getStart(), R.getEnd()});
}
return Error::success();
@@ -724,8 +723,7 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
if (auto *EHFrameSection = G.findSectionByName(ELFEHFrameSectionName)) {
jitlink::SectionRange R(*EHFrameSection);
if (!R.empty())
- POSR.EHFrameSection = {ExecutorAddr(R.getStart()),
- ExecutorAddr(R.getEnd())};
+ POSR.EHFrameSection = {R.getStart(), R.getEnd()};
}
// Get a pointer to the thread data section if there is one. It will be used
@@ -749,8 +747,7 @@ void ELFNixPlatform::ELFNixPlatformPlugin::addEHAndTLVSupportPasses(
if (ThreadDataSection) {
jitlink::SectionRange R(*ThreadDataSection);
if (!R.empty())
- POSR.ThreadDataSection = {ExecutorAddr(R.getStart()),
- ExecutorAddr(R.getEnd())};
+ POSR.ThreadDataSection = {R.getStart(), R.getEnd()};
}
if (POSR.EHFrameSection.Start || POSR.ThreadDataSection.Start) {
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
index 30d641ee00cf8..6777a205e3bc7 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
@@ -45,8 +45,7 @@ Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
assert((*Result)[0].size() == 1 &&
"Unexpected number of addresses in result");
- return std::make_unique<EPCDebugObjectRegistrar>(
- ES, ExecutorAddr((*Result)[0][0]));
+ return std::make_unique<EPCDebugObjectRegistrar>(ES, (*Result)[0][0]);
}
Error EPCDebugObjectRegistrar::registerDebugObject(
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
index 3aa94a7f43e2e..56cd982cd5e1f 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp
@@ -57,9 +57,8 @@ Expected<std::unique_ptr<EPCEHFrameRegistrar>> EPCEHFrameRegistrar::Create(
auto RegisterEHFrameWrapperFnAddr = (*Result)[0][0];
auto DeregisterEHFrameWrapperFnAddr = (*Result)[0][1];
- return std::make_unique<EPCEHFrameRegistrar>(
- ES, ExecutorAddr(RegisterEHFrameWrapperFnAddr),
- ExecutorAddr(DeregisterEHFrameWrapperFnAddr));
+ return std::make_unique<EPCEHFrameRegistrar>(ES, RegisterEHFrameWrapperFnAddr,
+ DeregisterEHFrameWrapperFnAddr);
}
Error EPCEHFrameRegistrar::registerEHFrames(ExecutorAddrRange EHFrameSection) {
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
index a3d857c3bfc4e..b05f08fd7cdfe 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.cpp
@@ -158,7 +158,7 @@ void EPCGenericJITLinkMemoryManager::completeAllocation(
auto &SegInfo = SegInfos[AG];
SegInfo.ContentSize = Seg.ContentSize;
SegInfo.ZeroFillSize = Seg.ZeroFillSize;
- SegInfo.Addr = ExecutorAddr(Seg.Addr);
+ SegInfo.Addr = Seg.Addr;
SegInfo.WorkingMem = Seg.WorkingMem;
}
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
index 0101a4695bfc6..833be826f8aed 100644
--- a/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/EPCIndirectionUtils.cpp
@@ -160,18 +160,16 @@ Error EPCIndirectStubsManager::createStubs(const StubInitsMap &StubInits) {
unsigned ASIdx = 0;
std::vector<tpctypes::UInt32Write> PtrUpdates;
for (auto &SI : StubInits)
- PtrUpdates.push_back(
- {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress),
- static_cast<uint32_t>(SI.second.first.getValue())});
+ PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress,
+ static_cast<uint32_t>(SI.second.first.getValue())});
return MemAccess.writeUInt32s(PtrUpdates);
}
case 8: {
unsigned ASIdx = 0;
std::vector<tpctypes::UInt64Write> PtrUpdates;
for (auto &SI : StubInits)
- PtrUpdates.push_back(
- {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress),
- static_cast<uint64_t>(SI.second.first.getValue())});
+ PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress,
+ static_cast<uint64_t>(SI.second.first.getValue())});
return MemAccess.writeUInt64s(PtrUpdates);
}
default:
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index 6a10bbeae335d..fb685e6c37271 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -568,7 +568,7 @@ DLLImportDefinitionGenerator::createStubsGraph(const SymbolMap &Resolved) {
for (auto &KV : Resolved) {
jitlink::Symbol &Target = G->addAbsoluteSymbol(
- *KV.first, ExecutorAddr(KV.second.getAddress()), *PointerSize,
+ *KV.first, KV.second.getAddress(), *PointerSize,
jitlink::Linkage::Strong, jitlink::Scope::Local, false);
// Create __imp_ symbol
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 8bc03a92bb78a..65e63eb2d932b 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -819,7 +819,7 @@ Expected<ExecutorAddr> LLJIT::lookupLinkerMangled(JITDylib &JD,
if (auto Sym = ES->lookup(
makeJITDylibSearchOrder(&JD, JITDylibLookupFlags::MatchAllSymbols),
Name))
- return ExecutorAddr(Sym->getAddress());
+ return Sym->getAddress();
else
return Sym.takeError();
}
diff --git a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
index fd8329c8958af..3c1e53365f9bf 100644
--- a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
@@ -49,7 +49,7 @@ Expected<int32_t> SimpleRemoteEPC::runAsMain(ExecutorAddr MainFnAddr,
ArrayRef<std::string> Args) {
int64_t Result = 0;
if (auto Err = callSPSWrapper<rt::SPSRunAsMainSignature>(
- RunAsMainAddr, Result, ExecutorAddr(MainFnAddr), Args))
+ RunAsMainAddr, Result, MainFnAddr, Args))
return std::move(Err);
return Result;
}
@@ -57,7 +57,7 @@ Expected<int32_t> SimpleRemoteEPC::runAsMain(ExecutorAddr MainFnAddr,
Expected<int32_t> SimpleRemoteEPC::runAsVoidFunction(ExecutorAddr VoidFnAddr) {
int32_t Result = 0;
if (auto Err = callSPSWrapper<rt::SPSRunAsVoidFunctionSignature>(
- RunAsVoidFunctionAddr, Result, ExecutorAddr(VoidFnAddr)))
+ RunAsVoidFunctionAddr, Result, VoidFnAddr))
return std::move(Err);
return Result;
}
@@ -66,7 +66,7 @@ Expected<int32_t> SimpleRemoteEPC::runAsIntFunction(ExecutorAddr IntFnAddr,
int Arg) {
int32_t Result = 0;
if (auto Err = callSPSWrapper<rt::SPSRunAsIntFunctionSignature>(
- RunAsIntFunctionAddr, Result, ExecutorAddr(IntFnAddr), Arg))
+ RunAsIntFunctionAddr, Result, IntFnAddr, Arg))
return std::move(Err);
return Result;
}
More information about the llvm-commits
mailing list