[llvm] e3d2b58 - [ORC][LLJIT] Improve debugging output, tighten assertion.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 8 13:03:02 PDT 2023


Author: Lang Hames
Date: 2023-04-08T13:02:56-07:00
New Revision: e3d2b584aae36a3d7d2a28b23ff1c5ec4f70974a

URL: https://github.com/llvm/llvm-project/commit/e3d2b584aae36a3d7d2a28b23ff1c5ec4f70974a
DIFF: https://github.com/llvm/llvm-project/commit/e3d2b584aae36a3d7d2a28b23ff1c5ec4f70974a.diff

LOG: [ORC][LLJIT] Improve debugging output, tighten assertion.

Clients can provide an ExecutionSession or an ExecutorProcessControl object to
LLJITBuilder, but should not provide both.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
    llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 5984d2d3f8a96..abc1c0c781619 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -342,6 +342,10 @@ class LLJITBuilderSetters {
 
   /// Set an ExecutionSession for this instance.
   SetterImpl &setExecutionSession(std::unique_ptr<ExecutionSession> ES) {
+    assert(
+        !impl().EPC &&
+        "setExecutionSession should not be called if an ExecutorProcessControl "
+        "object has already been set");
     impl().ES = std::move(ES);
     return impl();
   }

diff  --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index fd106f9dc3ef8..bc37b39950184 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -714,11 +714,17 @@ Error LLJITBuilderState::prepareForConstruction() {
       EPC = std::move(*EPCOrErr);
     else
       return EPCOrErr.takeError();
-  } else
+  } else if (EPC) {
     LLVM_DEBUG({
       dbgs() << "Using explicitly specified ExecutorProcessControl instance "
              << EPC.get() << "\n";
     });
+  } else {
+    LLVM_DEBUG({
+      dbgs() << "Using explicitly specified ExecutionSession instance "
+             << ES.get() << "\n";
+    });
+  }
 
   // If the client didn't configure any linker options then auto-configure the
   // JIT linker.


        


More information about the llvm-commits mailing list