[llvm] 9cffb2f - [LLJIT] Allow multiple loadPlatformDynamicLibrary calls with the same path.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 26 21:33:07 PDT 2023
Author: Lang Hames
Date: 2023-03-26T21:33:00-07:00
New Revision: 9cffb2f74114a870024ca6c9e675bdf0e2a6d0fb
URL: https://github.com/llvm/llvm-project/commit/9cffb2f74114a870024ca6c9e675bdf0e2a6d0fb
DIFF: https://github.com/llvm/llvm-project/commit/9cffb2f74114a870024ca6c9e675bdf0e2a6d0fb.diff
LOG: [LLJIT] Allow multiple loadPlatformDynamicLibrary calls with the same path.
Where the same dylib is loaded more than once we should just return the
JITDylib created by the first call rather than error out. This matches the
behavior of dlopen / LoadLibrary.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 602c0d7a16ab..7bd2b17e7565 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -764,11 +764,8 @@ Expected<JITDylib &> LLJIT::loadPlatformDynamicLibrary(const char *Path) {
if (!G)
return G.takeError();
- if (ES->getJITDylibByName(Path))
- return make_error<StringError>(
- Twine("LLJIT ExecutionSession already contains a JITDylib named \"") +
- Path + "\"",
- inconvertibleErrorCode());
+ if (auto *ExistingJD = ES->getJITDylibByName(Path))
+ return *ExistingJD;
auto &JD = ES->createBareJITDylib(Path);
JD.addGenerator(std::move(*G));
More information about the llvm-commits
mailing list