[llvm] 07ac314 - [Orc][LLJIT] Re-apply 298e183e813 (use JITLink for LLJIT where supported).

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 21:22:58 PST 2019


Author: Lang Hames
Date: 2019-12-19T20:42:26-08:00
New Revision: 07ac3145ccd5a43fe99e759afb6e8f1b08aca745

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

LOG: [Orc][LLJIT] Re-apply 298e183e813 (use JITLink for LLJIT where supported).

Patch d9220b580b3 fixed the underlying issue that casued 298e183e813 to fail.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h b/llvm/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h
index c8c4ecdaff16..4f2f55770996 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h
@@ -79,12 +79,18 @@ class JITTargetMachineBuilder {
     return *this;
   }
 
+  /// Get the relocation model.
+  const Optional<Reloc::Model> &getRelocationModel() const { return RM; }
+
   /// Set the code model.
   JITTargetMachineBuilder &setCodeModel(Optional<CodeModel::Model> CM) {
     this->CM = std::move(CM);
     return *this;
   }
 
+  /// Get the code model.
+  const Optional<CodeModel::Model> &getCodeModel() const { return CM; }
+
   /// Set the LLVM CodeGen optimization level.
   JITTargetMachineBuilder &setCodeGenOptLevel(CodeGenOpt::Level OptLevel) {
     this->OptLevel = OptLevel;

diff  --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 5c393739f401..54473ab46423 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -24,11 +24,15 @@ Error LLJITBuilderState::prepareForConstruction() {
       JTMB = std::move(*JTMBOrErr);
     else
       return JTMBOrErr.takeError();
+  }
+
+  // If the client didn't configure any linker options then auto-configure the
+  // JIT linker.
+  if (!CreateObjectLinkingLayer && JTMB->getCodeModel() == None &&
+      JTMB->getRelocationModel() == None) {
 
-    // If no ObjectLinkingLayer creator was set and the target supports JITLink
-    // then configure for JITLink.
     auto &TT = JTMB->getTargetTriple();
-    if (!CreateObjectLinkingLayer && TT.isOSBinFormatMachO() &&
+    if (TT.isOSBinFormatMachO() &&
         (TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) {
 
       JTMB->setRelocationModel(Reloc::PIC_);


        


More information about the llvm-commits mailing list