[clang] [llvm] [CGData][ThinLTO] Global Outlining with Two-CodeGen Rounds (PR #90933)

Kyungwoo Lee via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 18 07:10:27 PDT 2024


================
@@ -164,6 +164,22 @@ publishOutlinedHashTree(std::unique_ptr<OutlinedHashTree> HashTree) {
   CodeGenData::getInstance().publishOutlinedHashTree(std::move(HashTree));
 }
 
+/// Initialize the two-codegen rounds.
+void initializeTwoCodegenRounds();
+
+/// Save the current module before the first codegen round.
+void saveModuleForTwoRounds(const Module &TheModule, unsigned Task);
+
+/// Load the current module before the second codegen round.
+std::unique_ptr<Module> loadModuleForTwoRounds(BitcodeModule &OrigModule,
+                                               unsigned Task,
+                                               LLVMContext &Context);
+
+/// Merge the codegen data from the input files in scratch vector in ThinLTO
+/// two-codegen rounds.
+Error mergeCodeGenData(
+    const std::unique_ptr<std::vector<llvm::SmallString<0>>> InputFiles);
----------------
kyulee-com wrote:

> This is similar to a constant pointer. Can we use `ArrayRef` instead somehow?

The function `mergeCodeGenData` takes ownership of `InputFiles`. Once the function returns, the scratch buffer for the produced object files will be destroyed. I think this behavior is different from that of `ArrayRef`, which provides a read-only view into a vector.

https://github.com/llvm/llvm-project/pull/90933


More information about the cfe-commits mailing list