================
@@ -924,6 +930,54 @@ static bool canSkipModuleSplit(IRSplitMode Mode, const 
Module &M,
   });
 }
 
+/// AOT-compiles every JIT image in \p SplitModules concurrently and swaps each
+/// module's path to point at the compiled object.
+static Error aotCompileSplitModules(SmallVectorImpl<SplitModule> &SplitModules,
+                                    const ArgList &Args, StringRef OutputFile) 
{
+  // Each worker thread writes only its own index, so this is race-free.
+  SmallVector<std::string, 0> AOTFiles(SplitModules.size());
+  // std::optional, not Error: pre-filled Error::success() move-assigned
+  // from a worker thread would abort on the unchecked-value assert.
+  SmallVector<std::optional<Error>, 0> AOTErrors(SplitModules.size());
+  for (size_t I = 0, E = SplitModules.size(); I != E; ++I) {
----------------
wenju-he wrote:

done, thanks, much simpler now. Behavior change is that 
`llvm::heavyweight_hardware_concurrency()` (one thread per hardware core) is 
changed to `hardware_concurrency()` (hyperthreads also used). This should be 
fine and consistent with `clang-linker-wrapper` lines you mentioned.

https://github.com/llvm/llvm-project/pull/224548
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to