Fix MLIR Build after LLVM upstream JIT changes (getMainJITDylib removed)
authorMehdi Amini <aminim@google.com>
Thu, 5 Dec 2019 12:32:13 +0000 (04:32 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Thu, 5 Dec 2019 12:32:46 +0000 (04:32 -0800)
The getMainJITDylib() method was removed in 4fc68b9b7f, replace it by creating a JITDylib on the fly.

PiperOrigin-RevId: 283948595

mlir/lib/ExecutionEngine/ExecutionEngine.cpp

index 58f7838..2913c43 100644 (file)
@@ -234,9 +234,12 @@ Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
     auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>(
         session, []() { return std::make_unique<SectionMemoryManager>(); });
     auto dataLayout = deserModule->getDataLayout();
+    llvm::orc::JITDylib *mainJD = session.getJITDylibByName("<main>");
+    if (!mainJD)
+      mainJD = &session.createJITDylib("<main>");
 
     // Resolve symbols that are statically linked in the current process.
-    session.getMainJITDylib().addGenerator(
+    mainJD->addGenerator(
         cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
             dataLayout.getGlobalPrefix())));