Skip to content

Commit c751802

Browse files
committed
[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 e9e26c0, and would have pessimized concurrent compilation in the default case. Thanks for spotting this Don!
1 parent 2e39ea7 commit c751802

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
150150
}
151151
CompileLayer = std::make_unique<IRCompileLayer>(
152152
*ES, ObjTransformLayer, std::move(*CompileFunction));
153+
TransformLayer = std::make_unique<IRTransformLayer>(*ES, *CompileLayer);
153154
}
154155

155156
if (S.NumCompileThreads > 0) {
156-
CompileLayer->setCloneToNewContextOnEmit(true);
157+
TransformLayer->setCloneToNewContextOnEmit(true);
157158
CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads);
158159
ES->setDispatchMaterialization(
159160
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
@@ -163,8 +164,6 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
163164
CompileThreads->async(std::move(Work));
164165
});
165166
}
166-
167-
TransformLayer = std::make_unique<IRTransformLayer>(*ES, *CompileLayer);
168167
}
169168

170169
std::string LLJIT::mangle(StringRef UnmangledName) {

0 commit comments

Comments
 (0)