[llvm] [CGData] Lazy loading support for stable function map (PR #151660)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 10:36:19 PDT 2025


================
@@ -109,11 +115,20 @@ Error IndexedCodeGenDataReader::read() {
       return error(cgdata_error::eof);
     HashTreeRecord.deserialize(Ptr);
   }
+
+  // TODO: lazy loading support for outlined hash tree.
+  std::shared_ptr<MemoryBuffer> SharedDataBuffer = std::move(DataBuffer);
   if (hasStableFunctionMap()) {
     const unsigned char *Ptr = Start + Header.StableFunctionMapOffset;
     if (Ptr >= End)
       return error(cgdata_error::eof);
-    FunctionMapRecord.deserialize(Ptr, IndexedCodeGenDataReadFunctionMapNames);
+    if (IndexedCodeGenDataLazyLoading)
+      FunctionMapRecord.lazyDeserialize(SharedDataBuffer,
+                                        Header.StableFunctionMapOffset,
+                                        IndexedCodeGenDataReadFunctionMapNames);
----------------
kyulee-com wrote:

Now, you set `IndexedCodeGenDataReadFunctionMapNames` in `FunctionMap`. Can we set it (perhaps using an explicit function) before `if/else`? Then you don't need to pass around `IndexedCodeGenDataReadFunctionMapNames` arguments across many functions as you can just refer to it from the `FunctionMap`.

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


More information about the llvm-commits mailing list