[PATCH] D140627: [orc] Pass big parameters by reference, instead of by value

Feng Zou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 06:21:18 PST 2022


fzou1 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fzou1 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140627

Files:
  llvm/examples/OrcV2Examples/LLJITWithObjectCache/LLJITWithObjectCache.cpp
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
  llvm/tools/lli/lli.cpp


Index: llvm/tools/lli/lli.cpp
===================================================================
--- llvm/tools/lli/lli.cpp
+++ llvm/tools/lli/lli.cpp
@@ -897,7 +897,7 @@
     CacheManager = std::make_unique<LLIObjectCache>(ObjectCacheDir);
 
     Builder.setCompileFunctionCreator(
-      [&](orc::JITTargetMachineBuilder JTMB)
+      [&](orc::JITTargetMachineBuilder &JTMB)
             -> Expected<std::unique_ptr<orc::IRCompileLayer::IRCompiler>> {
         if (LazyJITCompileThreads > 0)
           return std::make_unique<orc::ConcurrentIRCompiler>(std::move(JTMB),
Index: llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -816,7 +816,7 @@
 
   /// If there is a custom compile function creator set then use it.
   if (S.CreateCompileFunction)
-    return S.CreateCompileFunction(std::move(JTMB));
+    return S.CreateCompileFunction(JTMB);
 
   // Otherwise default to creating a SimpleCompiler, or ConcurrentIRCompiler,
   // depending on the number of threads requested.
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -256,7 +256,7 @@
 
   using CompileFunctionCreator =
       std::function<Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>(
-          JITTargetMachineBuilder JTMB)>;
+          JITTargetMachineBuilder &JTMB)>;
 
   using PlatformSetupFunction = std::function<Error(LLJIT &J)>;
 
Index: llvm/examples/OrcV2Examples/LLJITWithObjectCache/LLJITWithObjectCache.cpp
===================================================================
--- llvm/examples/OrcV2Examples/LLJITWithObjectCache/LLJITWithObjectCache.cpp
+++ llvm/examples/OrcV2Examples/LLJITWithObjectCache/LLJITWithObjectCache.cpp
@@ -54,7 +54,7 @@
   auto J = ExitOnErr(
       LLJITBuilder()
           .setCompileFunctionCreator(
-              [&](JITTargetMachineBuilder JTMB)
+              [&](JITTargetMachineBuilder &JTMB)
                   -> Expected<std::unique_ptr<IRCompileLayer::IRCompiler>> {
                 auto TM = JTMB.createTargetMachine();
                 if (!TM)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140627.485107.patch
Type: text/x-patch
Size: 2301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221223/2c47b412/attachment.bin>


More information about the llvm-commits mailing list