From f99746f30a125324500cc7a46829fcfd44bed3dc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 4 Jul 2024 11:06:48 +0200 Subject: [PATCH] [Orc][RuntimeDyld] Return after handling error (#95364) If OnLoaded failed, return after passing the error to OnEmitted instead of also calling finalizeAsync (which would use values that have already been moved and perform another call to OnEmitted). --- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index a9aaff42433f65..79a190f447879d 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -1466,8 +1466,10 @@ void jitLinkForORC( return; } - if (auto Err = OnLoaded(*O.getBinary(), *Info, RTDyld.getSymbolTable())) + if (auto Err = OnLoaded(*O.getBinary(), *Info, RTDyld.getSymbolTable())) { OnEmitted(std::move(O), std::move(Info), std::move(Err)); + return; + } RuntimeDyldImpl::finalizeAsync(std::move(RTDyld.Dyld), std::move(OnEmitted), std::move(O), std::move(Info));