From: Lang Hames Date: Sat, 1 Apr 2023 00:51:01 +0000 (-0700) Subject: [ORC] Remove redundant ExecutorAddr temporaries. X-Git-Tag: upstream/17.0.6~12995 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5baaf0c23e467af1d9b5eb4a995c543dc1796953;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp index 6910fda..c08476a 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 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 9e99fa1..1ea700c 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 ab2f7a1..0446fa6 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 FA) { diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp index 6128cfe..ce47c87 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 30d641e..6777a20 100644 --- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp +++ b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp @@ -45,8 +45,7 @@ Expected> createJITLoaderGDBRegistrar( assert((*Result)[0].size() == 1 && "Unexpected number of addresses in result"); - return std::make_unique( - ES, ExecutorAddr((*Result)[0][0])); + return std::make_unique(ES, (*Result)[0][0]); } Error EPCDebugObjectRegistrar::registerDebugObject( diff --git a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp index 3aa94a7..56cd982 100644 --- a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp +++ b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp @@ -57,9 +57,8 @@ Expected> EPCEHFrameRegistrar::Create( auto RegisterEHFrameWrapperFnAddr = (*Result)[0][0]; auto DeregisterEHFrameWrapperFnAddr = (*Result)[0][1]; - return std::make_unique( - ES, ExecutorAddr(RegisterEHFrameWrapperFnAddr), - ExecutorAddr(DeregisterEHFrameWrapperFnAddr)); + return std::make_unique(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 a3d857c..b05f08f 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 0101a46..833be82 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 PtrUpdates; for (auto &SI : StubInits) - PtrUpdates.push_back( - {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress), - static_cast(SI.second.first.getValue())}); + PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress, + static_cast(SI.second.first.getValue())}); return MemAccess.writeUInt32s(PtrUpdates); } case 8: { unsigned ASIdx = 0; std::vector PtrUpdates; for (auto &SI : StubInits) - PtrUpdates.push_back( - {ExecutorAddr((*AvailableStubInfos)[ASIdx++].PointerAddress), - static_cast(SI.second.first.getValue())}); + PtrUpdates.push_back({(*AvailableStubInfos)[ASIdx++].PointerAddress, + static_cast(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 6a10bbe..fb685e6 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 8bc03a9..65e63eb 100644 --- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp +++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp @@ -819,7 +819,7 @@ Expected 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 fd8329c..3c1e533 100644 --- a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp +++ b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp @@ -49,7 +49,7 @@ Expected SimpleRemoteEPC::runAsMain(ExecutorAddr MainFnAddr, ArrayRef Args) { int64_t Result = 0; if (auto Err = callSPSWrapper( - RunAsMainAddr, Result, ExecutorAddr(MainFnAddr), Args)) + RunAsMainAddr, Result, MainFnAddr, Args)) return std::move(Err); return Result; } @@ -57,7 +57,7 @@ Expected SimpleRemoteEPC::runAsMain(ExecutorAddr MainFnAddr, Expected SimpleRemoteEPC::runAsVoidFunction(ExecutorAddr VoidFnAddr) { int32_t Result = 0; if (auto Err = callSPSWrapper( - RunAsVoidFunctionAddr, Result, ExecutorAddr(VoidFnAddr))) + RunAsVoidFunctionAddr, Result, VoidFnAddr)) return std::move(Err); return Result; } @@ -66,7 +66,7 @@ Expected SimpleRemoteEPC::runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) { int32_t Result = 0; if (auto Err = callSPSWrapper( - RunAsIntFunctionAddr, Result, ExecutorAddr(IntFnAddr), Arg)) + RunAsIntFunctionAddr, Result, IntFnAddr, Arg)) return std::move(Err); return Result; }