[llvm] [DTLTO] [LLVM] Initial DTLTO cache implementation (PR #156433)

Katya Romanova via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 23:29:29 PDT 2025


================
@@ -2512,15 +2560,32 @@ class OutOfProcessThinBackend : public CGThinBackend {
             BCError + "cannot open native object file: " +
                 Job.NativeObjectPath + ": " + EC.message(),
             inconvertibleErrorCode());
-      auto StreamOrErr = AddStream(Job.Task, Job.ModuleID);
-      if (Error Err = StreamOrErr.takeError())
-        report_fatal_error(std::move(Err));
-      auto &Stream = *StreamOrErr->get();
-      *Stream.OS << ObjFileMbOrErr->get()->getMemBufferRef().getBuffer();
-      if (Error Err = Stream.commit())
-        report_fatal_error(std::move(Err));
-    }
 
+      MemoryBufferRef ObjFileMbRef = ObjFileMbOrErr->get()->getMemBufferRef();
+      if (Cache.isValid() && Job.CacheAddStream) {
----------------
romanova-ekaterina wrote:

Or maybe will be clearer. 
Replace this condition with Cache.isValid() and add a comment later saying that if we got to this point, we could only have cache miss.

``` 
if (Cache.isValid())
{ 
  // Cache hits are takes care of earlier. At this point, we could only have cache misses.
  ...
} else
{
 ...
}
```

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


More information about the llvm-commits mailing list