[llvm] c751802 - [ORC] Set setCloneToNewContextOnEmit on LLJIT's transform layer when needed.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 10:23:54 PST 2020


Author: Lang Hames
Date: 2020-01-15T10:22:57-08:00
New Revision: c75180258e6363a03fc036abaa4c79a14a3f952e

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

LOG: [ORC] Set setCloneToNewContextOnEmit on LLJIT's transform layer when needed.

Based on Don Hinton's patch in https://reviews.llvm.org/D72406. This feature
was accidentally left out of e9e26c01cd865da678b1af6ba5f417c713956a66, and
would have pessimized concurrent compilation in the default case.

Thanks for spotting this Don!

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 50f7d3b489e7..fbae75ba7937 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -150,10 +150,11 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
     }
     CompileLayer = std::make_unique<IRCompileLayer>(
         *ES, ObjTransformLayer, std::move(*CompileFunction));
+    TransformLayer = std::make_unique<IRTransformLayer>(*ES, *CompileLayer);
   }
 
   if (S.NumCompileThreads > 0) {
-    CompileLayer->setCloneToNewContextOnEmit(true);
+    TransformLayer->setCloneToNewContextOnEmit(true);
     CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads);
     ES->setDispatchMaterialization(
         [this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
@@ -163,8 +164,6 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
           CompileThreads->async(std::move(Work));
         });
   }
-
-  TransformLayer = std::make_unique<IRTransformLayer>(*ES, *CompileLayer);
 }
 
 std::string LLJIT::mangle(StringRef UnmangledName) {


        


More information about the llvm-commits mailing list