[lld] [llvm] [DTLTO] support distributing bitcode from FatLTO objects (PR #176928)

Rose Hudson via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 05:22:22 PST 2026


https://github.com/rosefromthedead updated https://github.com/llvm/llvm-project/pull/176928

>From ced5e0ea431cce9f90d4a8ef29daaddcd49b5def Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Fri, 16 Jan 2026 14:14:22 +0000
Subject: [PATCH 01/12] [DTLTO] support distributing bitcode from FatLTO
 objects

We already have code to extract bitcode files from archives so they can
be distributed. Extend this code to extract bitcode from FatLTO objects
too, which otherwise cannot be used with DTLTO.
---
 lld/ELF/Driver.cpp                     |  6 ++-
 lld/test/ELF/dtlto/fat-lto-object.test | 61 ++++++++++++++++++++++++++
 llvm/include/llvm/LTO/LTO.h            | 16 ++++---
 llvm/lib/DTLTO/DTLTO.cpp               | 20 ++++-----
 4 files changed, 86 insertions(+), 17 deletions(-)
 create mode 100644 lld/test/ELF/dtlto/fat-lto-object.test

diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 8647752be31fe..9944cf2e73700 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -236,8 +236,10 @@ bool LinkerDriver::tryAddFatLTOFile(MemoryBufferRef mb, StringRef archiveName,
       IRObjectFile::findBitcodeInMemBuffer(mb);
   if (errorToBool(fatLTOData.takeError()))
     return false;
-  files.push_back(std::make_unique<BitcodeFile>(ctx, *fatLTOData, archiveName,
-                                                offsetInArchive, lazy));
+  auto file = std::make_unique<BitcodeFile>(ctx, *fatLTOData, archiveName,
+                                            offsetInArchive, lazy);
+  file->obj->fatLTOObject(true);
+  files.push_back(std::move(file));
   return true;
 }
 
diff --git a/lld/test/ELF/dtlto/fat-lto-object.test b/lld/test/ELF/dtlto/fat-lto-object.test
new file mode 100644
index 0000000000000..dad46fc732435
--- /dev/null
+++ b/lld/test/ELF/dtlto/fat-lto-object.test
@@ -0,0 +1,61 @@
+REQUIRES: x86
+
+## Test that a DTLTO link can use FatLTO objects as inputs, even if they're in archives.
+
+RUN: rm -rf %t && split-file %s %t && cd %t
+
+RUN: sed 's/@t1/@t2/g' t1.ll > t2.ll
+RUN: sed 's/@t1/@t3/g' t1.ll > t3.ll
+
+## Taken from lld/test/ELF/fatlto/fatlto.test
+RUN: llc t1.ll --filetype=obj -o t1.o --relocation-model=pic
+RUN: opt < t1.ll --module-summary -o t1.bc
+RUN: llvm-objcopy --add-section=.llvm.lto=t1.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t1.o
+
+RUN: llc t2.ll --filetype=obj -o t2.o --relocation-model=pic
+RUN: opt < t2.ll --module-summary -o t2.bc
+RUN: llvm-objcopy --add-section=.llvm.lto=t2.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t2.o
+
+RUN: llc t3.ll --filetype=obj -o t3.o --relocation-model=pic
+RUN: opt < t3.ll --module-summary -o t3.bc
+RUN: llvm-objcopy --add-section=.llvm.lto=t3.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t3.o
+
+## Create thin and regular archives containing FatLTO objects to test that we
+## can combine these weird file types.
+RUN: llvm-ar rcsT t1.a t1.o
+RUN: llvm-ar rcs t2.a t2.o
+
+RUN: echo "t1.a t2.a t3.o \
+RUN:   --thinlto-distributor=\"%python\" \
+RUN:   --thinlto-distributor-arg=\"%llvm_src_root/utils/dtlto/validate.py\"" > args
+
+## Link thin archives using -u/--undefined.
+RUN: not ld.lld --fat-lto-objects @args -u t1 -u t2 2>&1
+
+## Link thin archives using --whole-archive.
+RUN: not ld.lld --fat-lto-objects --whole-archive @args 2>&1
+
+## Check the module IDs in the JSON jobs description.
+CHECK: "jobs": [
+CHECK: "inputs": [
+CHECK-NEXT: "{{([a-zA-Z]:)|/}}
+CHECK-SAME: t1.bc"
+
+CHECK: "inputs": [
+CHECK-NEXT: "{{([a-zA-Z]\:)|/}}
+CHECK-SAME: t2.bc"
+
+CHECK: "inputs": [
+CHECK-NEXT: "{{([a-zA-Z]:)|/}}
+CHECK-SAME: t3.bc"
+
+## Ensure backend compilation fails as expected (due to validate.py dummy behavior).
+CHECK: error: DTLTO backend compilation: cannot open native object file:
+
+#--- t1.ll
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @t1() {
+  ret void
+}
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index cba5cf7eb9e62..d51add9fa4230 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -131,7 +131,8 @@ class InputFile {
   std::vector<std::pair<StringRef, Comdat::SelectionKind>> ComdatTable;
 
   MemoryBufferRef MbRef;
-  bool IsMemberOfArchive = false;
+  bool IsFatLTOObject = false;
+  bool IsEntireFile = true;
   bool IsThinLTO = false;
   StringRef ArchivePath;
   StringRef MemberName;
@@ -198,10 +199,15 @@ class InputFile {
   LLVM_ABI BitcodeModule &getPrimaryBitcodeModule();
   // Returns the memory buffer reference for this input file.
   MemoryBufferRef getFileBuffer() const { return MbRef; }
-  // Returns true if this input file is a member of an archive.
-  bool isMemberOfArchive() const { return IsMemberOfArchive; }
-  // Mark this input file as a member of archive.
-  void memberOfArchive(bool MA) { IsMemberOfArchive = MA; }
+  // Returns false if this input file is a member of an archive or of a FatLTO
+  // object.
+  bool isEntireFile() const { return IsEntireFile; }
+  // Mark this input file as being an entire file on disk.
+  void entireFile(bool EF) { IsEntireFile = EF; }
+  // Returns true if this bitcode came from a FatLTO object.
+  bool isFatLTOObject() const { return IsFatLTOObject; }
+  // Mark this bitcode as coming from a FatLTO object.
+  void fatLTOObject(bool FO) { IsFatLTOObject = FO; }
 
   // Returns true if bitcode is ThinLTO.
   bool isThinLTO() const { return IsThinLTO; }
diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index b9a5cd3a062e2..bb99d3f3ca460 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -21,14 +21,12 @@
 #include "llvm/LTO/LTO.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
 
-#include <iostream>
 #include <string>
 
 using namespace llvm;
@@ -134,15 +132,17 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
   StringRef ModuleId = Input->getName();
   StringRef ArchivePath = Input->getArchivePath();
 
-  // Only process archive members.
-  if (ArchivePath.empty())
+  // Only process archive members and FatLTO objects.
+  if (ArchivePath.empty() && !Input->isFatLTOObject())
     return Input;
 
   SmallString<64> NewModuleId;
   BitcodeModule &BM = Input->getPrimaryBitcodeModule();
 
-  // Check if the archive is a thin archive.
-  Expected<bool> IsThin = isThinArchive(ArchivePath);
+  // Check if the archive is a thin archive and the object is not fat.
+  // This means we have a file already that we can point to.
+  Expected<bool> IsThin =
+      Input->isFatLTOObject() ? false : isThinArchive(ArchivePath);
   if (!IsThin)
     return IsThin.takeError();
 
@@ -151,8 +151,8 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
     NewModuleId =
         computeThinArchiveMemberPath(ArchivePath, Input->getMemberName());
   } else {
-    // For regular archives, generate a unique name.
-    Input->memberOfArchive(true);
+    // For regular archives and FatLTO objects, generate a unique name.
+    Input->entireFile(false);
 
     // Create unique identifier using process ID and sequence number.
     std::string PID = utohexstr(sys::Process::getProcessId());
@@ -172,7 +172,7 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
 // previously terminated linker process and can be safely overwritten.
 Error lto::DTLTO::saveInputArchiveMember(lto::InputFile *Input) {
   StringRef ModuleId = Input->getName();
-  if (Input->isMemberOfArchive()) {
+  if (!Input->isEntireFile()) {
     TimeTraceScope TimeScope("Save input archive member for DTLTO", ModuleId);
     MemoryBufferRef MemoryBufferRef = Input->getFileBuffer();
     if (Error EC = saveBuffer(MemoryBufferRef.getBuffer(), ModuleId))
@@ -210,7 +210,7 @@ void lto::DTLTO::cleanup() {
   {
     TimeTraceScope TimeScope("Remove temporary inputs for DTLTO");
     for (auto &Input : InputFiles)
-      if (Input->isMemberOfArchive())
+      if (!Input->isEntireFile())
         sys::fs::remove(Input->getName(), /*IgnoreNonExisting=*/true);
   }
   Base::cleanup();

>From 0d8002722f2ced1265f100e74a7bef1e6accba6b Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 21 Jan 2026 14:25:23 +0000
Subject: [PATCH 02/12] test in cross-project-tests instead

built from cross-project-tests/dtlto/archive.test
---
 .../dtlto/fat-lto-objects.test                | 82 +++++++++++++++++++
 lld/test/ELF/dtlto/fat-lto-object.test        | 61 --------------
 2 files changed, 82 insertions(+), 61 deletions(-)
 create mode 100644 cross-project-tests/dtlto/fat-lto-objects.test
 delete mode 100644 lld/test/ELF/dtlto/fat-lto-object.test

diff --git a/cross-project-tests/dtlto/fat-lto-objects.test b/cross-project-tests/dtlto/fat-lto-objects.test
new file mode 100644
index 0000000000000..af0506862e064
--- /dev/null
+++ b/cross-project-tests/dtlto/fat-lto-objects.test
@@ -0,0 +1,82 @@
+REQUIRES: ld.lld,llvm-ar
+
+# Test that a DTLTO link succeeds and outputs the expected set of files
+# correctly when FatLTO objects are present.
+
+RUN: rm -rf %t && split-file %s %t && cd %t
+# Compile sources into bitcode. -O2 is required for cross-module importing.
+RUN: %clang -O2 -ffat-lto-objects --target=x86_64-linux-gnu -flto=thin -c foo.c boo.c moo.c loo.c voo.c
+RUN: %clang -O2 --target=x86_64-linux-gnu -flto=thin -c main.c
+
+# Put some objects in an archive, some in a thin archive, and leave foo.o bare to test all combinations.
+RUN: llvm-ar rcs archive.a boo.o moo.o
+RUN: llvm-ar rcsT archive.thin.a loo.o voo.o
+
+# Build with DTLTO.
+RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -ffat-lto-objects \
+RUN:   -fuse-ld=lld -nostdlib -e main \
+RUN:   main.o foo.o archive.a archive.thin.a -o main.elf \
+RUN:   -Wl,--thinlto-distributor=%python \
+RUN:   -Wl,--thinlto-distributor-arg=%llvm_src_root/utils/dtlto/local.py \
+RUN:   -Wl,--thinlto-remote-compiler=%clang \
+RUN:   -Wl,--save-temps
+
+# Check that the required output files have been created.
+RUN: ls | FileCheck %s --check-prefix=OUTPUTS
+
+# JSON jobs description.
+OUTPUTS-DAG:    {{^}}main.[[PID:[0-9]+]].dist-file.json
+
+# Main source.
+OUTPUTS-DAG:    {{^}}main.{{[0-9]+}}.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}main.{{[0-9]+}}.[[PID]].native.o.thinlto.bc{{$}}
+
+# Bare FatLTO object.
+OUTPUTS-DAG:    {{^}}foo.o.2.[[HEXPID:[a-fA-F0-9]+]].2.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}foo.o.2.[[HEXPID]].2.[[PID]].native.o.thinlto.bc{{$}}
+
+# Regular archive members.
+# Filename composition: <archive>(<member> at <offset>).<task>.<pid>.<task>.<pid>.native.o[.thinlto.bc].
+OUTPUTS-DAG:    {{^}}archive.a(boo.o at {{[0-9]+}}).3.[[HEXPID]].3.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}archive.a(boo.o at {{[0-9]+}}).3.[[HEXPID]].3.[[PID]].native.o.thinlto.bc{{$}}
+
+OUTPUTS-DAG:    {{^}}archive.a(moo.o at {{[0-9]+}}).4.[[HEXPID]].4.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}archive.a(moo.o at {{[0-9]+}}).4.[[HEXPID]].4.[[PID]].native.o.thinlto.bc{{$}}
+
+# Thin archive members.
+OUTPUTS-DAG:    {{^}}archive.thin.a(voo.o at {{[0-9]+}}).5.[[HEXPID]].5.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}archive.thin.a(voo.o at {{[0-9]+}}).5.[[HEXPID]].5.[[PID]].native.o.thinlto.bc{{$}}
+
+OUTPUTS-DAG:    {{^}}archive.thin.a(loo.o at {{[0-9]+}}).6.[[HEXPID]].6.[[PID]].native.o{{$}}
+OUTPUTS-DAG:    {{^}}archive.thin.a(loo.o at {{[0-9]+}}).6.[[HEXPID]].6.[[PID]].native.o.thinlto.bc{{$}}
+
+# Executable file.
+OUTPUTS-DAG:    {{^}}main.elf{{$}}
+
+#--- foo.c
+volatile int foo_int;
+__attribute__((retain)) int foo(int x) { return x + foo_int; }
+
+#--- boo.c
+extern int foo(int x);
+__attribute__((retain)) int boo(int x) { return foo(x); }
+
+#--- moo.c
+__attribute__((retain)) int moo() { return 3; }
+
+#--- loo.c
+extern int moo(int x);
+__attribute__((retain)) int loo(int x) { return moo(x); }
+
+#--- voo.c
+extern int foo(int x);
+extern int loo(int x);
+__attribute__((retain)) int voo(int x) { return foo(x) + loo(x + 1) + 7; }
+
+#--- main.c
+extern int boo(int x);
+extern int moo();
+extern int voo(int x);
+__attribute__((retain)) int main(int argc, char** argv) {
+  return boo(argc) + moo() + voo(argc + 3);
+}
diff --git a/lld/test/ELF/dtlto/fat-lto-object.test b/lld/test/ELF/dtlto/fat-lto-object.test
deleted file mode 100644
index dad46fc732435..0000000000000
--- a/lld/test/ELF/dtlto/fat-lto-object.test
+++ /dev/null
@@ -1,61 +0,0 @@
-REQUIRES: x86
-
-## Test that a DTLTO link can use FatLTO objects as inputs, even if they're in archives.
-
-RUN: rm -rf %t && split-file %s %t && cd %t
-
-RUN: sed 's/@t1/@t2/g' t1.ll > t2.ll
-RUN: sed 's/@t1/@t3/g' t1.ll > t3.ll
-
-## Taken from lld/test/ELF/fatlto/fatlto.test
-RUN: llc t1.ll --filetype=obj -o t1.o --relocation-model=pic
-RUN: opt < t1.ll --module-summary -o t1.bc
-RUN: llvm-objcopy --add-section=.llvm.lto=t1.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t1.o
-
-RUN: llc t2.ll --filetype=obj -o t2.o --relocation-model=pic
-RUN: opt < t2.ll --module-summary -o t2.bc
-RUN: llvm-objcopy --add-section=.llvm.lto=t2.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t2.o
-
-RUN: llc t3.ll --filetype=obj -o t3.o --relocation-model=pic
-RUN: opt < t3.ll --module-summary -o t3.bc
-RUN: llvm-objcopy --add-section=.llvm.lto=t3.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c t3.o
-
-## Create thin and regular archives containing FatLTO objects to test that we
-## can combine these weird file types.
-RUN: llvm-ar rcsT t1.a t1.o
-RUN: llvm-ar rcs t2.a t2.o
-
-RUN: echo "t1.a t2.a t3.o \
-RUN:   --thinlto-distributor=\"%python\" \
-RUN:   --thinlto-distributor-arg=\"%llvm_src_root/utils/dtlto/validate.py\"" > args
-
-## Link thin archives using -u/--undefined.
-RUN: not ld.lld --fat-lto-objects @args -u t1 -u t2 2>&1
-
-## Link thin archives using --whole-archive.
-RUN: not ld.lld --fat-lto-objects --whole-archive @args 2>&1
-
-## Check the module IDs in the JSON jobs description.
-CHECK: "jobs": [
-CHECK: "inputs": [
-CHECK-NEXT: "{{([a-zA-Z]:)|/}}
-CHECK-SAME: t1.bc"
-
-CHECK: "inputs": [
-CHECK-NEXT: "{{([a-zA-Z]\:)|/}}
-CHECK-SAME: t2.bc"
-
-CHECK: "inputs": [
-CHECK-NEXT: "{{([a-zA-Z]:)|/}}
-CHECK-SAME: t3.bc"
-
-## Ensure backend compilation fails as expected (due to validate.py dummy behavior).
-CHECK: error: DTLTO backend compilation: cannot open native object file:
-
-#--- t1.ll
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @t1() {
-  ret void
-}

>From 7cd8315b713f65e95b49157b1548ceb12bf8edc0 Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 21 Jan 2026 14:40:02 +0000
Subject: [PATCH 03/12] use "materialize" for writing bitcode blobs to disk for
 distribution

---
 llvm/include/llvm/LTO/LTO.h |  9 ++++-----
 llvm/lib/DTLTO/DTLTO.cpp    | 13 +++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index d51add9fa4230..2299957f2cfaa 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -132,7 +132,7 @@ class InputFile {
 
   MemoryBufferRef MbRef;
   bool IsFatLTOObject = false;
-  bool IsEntireFile = true;
+  bool ShouldMaterialize = false;
   bool IsThinLTO = false;
   StringRef ArchivePath;
   StringRef MemberName;
@@ -199,11 +199,10 @@ class InputFile {
   LLVM_ABI BitcodeModule &getPrimaryBitcodeModule();
   // Returns the memory buffer reference for this input file.
   MemoryBufferRef getFileBuffer() const { return MbRef; }
-  // Returns false if this input file is a member of an archive or of a FatLTO
-  // object.
-  bool isEntireFile() const { return IsEntireFile; }
+  // Returns true if this input should be materialized to disk for distribution.
+  bool shouldMaterialize() const { return ShouldMaterialize; }
   // Mark this input file as being an entire file on disk.
-  void entireFile(bool EF) { IsEntireFile = EF; }
+  void setShouldMaterialize(bool SM) { ShouldMaterialize = SM; }
   // Returns true if this bitcode came from a FatLTO object.
   bool isFatLTOObject() const { return IsFatLTOObject; }
   // Mark this bitcode as coming from a FatLTO object.
diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index bb99d3f3ca460..7aa87aa83c068 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -139,8 +139,9 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
   SmallString<64> NewModuleId;
   BitcodeModule &BM = Input->getPrimaryBitcodeModule();
 
-  // Check if the archive is a thin archive and the object is not fat.
-  // This means we have a file already that we can point to.
+  // For a member of a thin archive that is not a FatLTO object, there is an
+  // existing file on disk that can be used, so we can avoid having to
+  // materialize.
   Expected<bool> IsThin =
       Input->isFatLTOObject() ? false : isThinArchive(ArchivePath);
   if (!IsThin)
@@ -152,7 +153,7 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
         computeThinArchiveMemberPath(ArchivePath, Input->getMemberName());
   } else {
     // For regular archives and FatLTO objects, generate a unique name.
-    Input->entireFile(false);
+    Input->setShouldMaterialize(true);
 
     // Create unique identifier using process ID and sequence number.
     std::string PID = utohexstr(sys::Process::getProcessId());
@@ -172,8 +173,8 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
 // previously terminated linker process and can be safely overwritten.
 Error lto::DTLTO::saveInputArchiveMember(lto::InputFile *Input) {
   StringRef ModuleId = Input->getName();
-  if (!Input->isEntireFile()) {
-    TimeTraceScope TimeScope("Save input archive member for DTLTO", ModuleId);
+  if (Input->shouldMaterialize()) {
+    TimeTraceScope TimeScope("Materialize bitcode input for DTLTO", ModuleId);
     MemoryBufferRef MemoryBufferRef = Input->getFileBuffer();
     if (Error EC = saveBuffer(MemoryBufferRef.getBuffer(), ModuleId))
       return EC;
@@ -210,7 +211,7 @@ void lto::DTLTO::cleanup() {
   {
     TimeTraceScope TimeScope("Remove temporary inputs for DTLTO");
     for (auto &Input : InputFiles)
-      if (!Input->isEntireFile())
+      if (Input->shouldMaterialize())
         sys::fs::remove(Input->getName(), /*IgnoreNonExisting=*/true);
   }
   Base::cleanup();

>From d190c8b6a8d609c82e1fbf4d6ccb730e1f2b92e7 Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 21 Jan 2026 14:43:20 +0000
Subject: [PATCH 04/12] clarify comment about when distribution logic is needed

---
 llvm/lib/DTLTO/DTLTO.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index 7aa87aa83c068..fce4b6454cfa3 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -132,7 +132,8 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
   StringRef ModuleId = Input->getName();
   StringRef ArchivePath = Input->getArchivePath();
 
-  // Only process archive members and FatLTO objects.
+  // In most cases, the module ID already points to an individual bitcode file
+  // on disk, so no further preparation for distribution is required.
   if (ArchivePath.empty() && !Input->isFatLTOObject())
     return Input;
 

>From 57d4dd9d1cd42b24f3a96bad30d34875248019eb Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 21 Jan 2026 14:43:36 +0000
Subject: [PATCH 05/12] IsThin -> UseThinMember

yeah real
---
 llvm/lib/DTLTO/DTLTO.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index fce4b6454cfa3..d27932fa4a6b8 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -143,12 +143,12 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
   // For a member of a thin archive that is not a FatLTO object, there is an
   // existing file on disk that can be used, so we can avoid having to
   // materialize.
-  Expected<bool> IsThin =
+  Expected<bool> UseThinMember =
       Input->isFatLTOObject() ? false : isThinArchive(ArchivePath);
-  if (!IsThin)
-    return IsThin.takeError();
+  if (!UseThinMember)
+    return UseThinMember.takeError();
 
-  if (*IsThin) {
+  if (*UseThinMember) {
     // For thin archives, use the path to the actual file.
     NewModuleId =
         computeThinArchiveMemberPath(ArchivePath, Input->getMemberName());

>From 51c513321ac96691c6ab8bb871dd5da0c0f75f55 Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 21 Jan 2026 15:19:51 +0000
Subject: [PATCH 06/12] fix timetrace test for new message

---
 lld/test/ELF/dtlto/timetrace.test | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lld/test/ELF/dtlto/timetrace.test b/lld/test/ELF/dtlto/timetrace.test
index 639ad36f8019f..58d1492f4b9cf 100644
--- a/lld/test/ELF/dtlto/timetrace.test
+++ b/lld/test/ELF/dtlto/timetrace.test
@@ -32,14 +32,14 @@ RUN: %python filter_order_and_pprint.py %t.json | FileCheck %s
 ## Check that DTLTO add input file events are recorded.
 CHECK:      "name": "Add input for DTLTO"
 CHECK:      "name": "Add input for DTLTO"
-CHECK:      "name": "Remove temporary inputs for DTLTO"
-CHECK:      "name": "Save input archive member for DTLTO"
+CHECK:      "name": "Materialize bitcode input for DTLTO"
 CHECK-SAME:   "detail": "t1.a(t1.bc at [[#ARCHIVE_OFFSET:]]).1.[[PID:[A-F0-9]+]].o"
+CHECK:      "name": "Remove temporary inputs for DTLTO"
 CHECK:      "name": "Total Add input for DTLTO"
 CHECK-SAME:   "count": 2,
-CHECK:      "name": "Total Remove temporary inputs for DTLTO"
+CHECK:      "name": "Total Materialize bitcode input for DTLTO"
 CHECK-SAME:   "count": 1,
-CHECK:      "name": "Total Save input archive member for DTLTO"
+CHECK:      "name": "Total Remove temporary inputs for DTLTO"
 CHECK-SAME:   "count": 1,
 
 #--- t1.ll

>From d7762993e8be8e27c725db3fc56709a50331086d Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose at krx.sh>
Date: Wed, 21 Jan 2026 15:22:51 +0000
Subject: [PATCH 07/12] finish off last "entire file" reference, -> materialize

Co-authored-by: Ben Dunbobbin <Ben.Dunbobbin at sony.com>
---
 llvm/include/llvm/LTO/LTO.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 2299957f2cfaa..a067daaf39d37 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -201,7 +201,7 @@ class InputFile {
   MemoryBufferRef getFileBuffer() const { return MbRef; }
   // Returns true if this input should be materialized to disk for distribution.
   bool shouldMaterialize() const { return ShouldMaterialize; }
-  // Mark this input file as being an entire file on disk.
+  // Mark whether this input should be materialized to disk for distribution.
   void setShouldMaterialize(bool SM) { ShouldMaterialize = SM; }
   // Returns true if this bitcode came from a FatLTO object.
   bool isFatLTOObject() const { return IsFatLTOObject; }

>From 1367ae5ba8464a70a2f886f3f020394eac5bc6ee Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Tue, 27 Jan 2026 14:06:41 +0000
Subject: [PATCH 08/12] use Ben's test

---
 .../dtlto/fat-lto-objects.test                | 109 +++++++-----------
 1 file changed, 40 insertions(+), 69 deletions(-)

diff --git a/cross-project-tests/dtlto/fat-lto-objects.test b/cross-project-tests/dtlto/fat-lto-objects.test
index af0506862e064..c379fef8c6979 100644
--- a/cross-project-tests/dtlto/fat-lto-objects.test
+++ b/cross-project-tests/dtlto/fat-lto-objects.test
@@ -2,81 +2,52 @@ REQUIRES: ld.lld,llvm-ar
 
 # Test that a DTLTO link succeeds and outputs the expected set of files
 # correctly when FatLTO objects are present.
-
 RUN: rm -rf %t && split-file %s %t && cd %t
-# Compile sources into bitcode. -O2 is required for cross-module importing.
-RUN: %clang -O2 -ffat-lto-objects --target=x86_64-linux-gnu -flto=thin -c foo.c boo.c moo.c loo.c voo.c
-RUN: %clang -O2 --target=x86_64-linux-gnu -flto=thin -c main.c
 
-# Put some objects in an archive, some in a thin archive, and leave foo.o bare to test all combinations.
-RUN: llvm-ar rcs archive.a boo.o moo.o
-RUN: llvm-ar rcsT archive.thin.a loo.o voo.o
+# Compile bitcode. -O2 is required for cross-module importing.
+RUN: %clang -O2 --target=x86_64-linux-gnu -flto=thin -ffat-lto-objects -c \
+RUN:   foo.c boo.c start.c
+
+# We want to test FatLTO objects when included in archives.
+RUN: llvm-ar rcs foo.a foo.o
+RUN: llvm-ar rcsT boo.a boo.o
 
 # Build with DTLTO.
-RUN: %clang -O2 --target=x86_64-linux-gnu -Werror -flto=thin -ffat-lto-objects \
-RUN:   -fuse-ld=lld -nostdlib -e main \
-RUN:   main.o foo.o archive.a archive.thin.a -o main.elf \
-RUN:   -Wl,--thinlto-distributor=%python \
-RUN:   -Wl,--thinlto-distributor-arg=%llvm_src_root/utils/dtlto/local.py \
-RUN:   -Wl,--thinlto-remote-compiler=%clang \
-RUN:   -Wl,--save-temps
+RUN: %clang --target=x86_64-linux-gnu -flto=thin -ffat-lto-objects \
+RUN:   -fuse-ld=lld -nostdlib foo.a boo.a start.o -Wl,--save-temps \
+RUN:   -fthinlto-distributor=%python \
+RUN:   -Xthinlto-distributor=%llvm_src_root/utils/dtlto/local.py
 
 # Check that the required output files have been created.
-RUN: ls | FileCheck %s --check-prefix=OUTPUTS
-
-# JSON jobs description.
-OUTPUTS-DAG:    {{^}}main.[[PID:[0-9]+]].dist-file.json
-
-# Main source.
-OUTPUTS-DAG:    {{^}}main.{{[0-9]+}}.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}main.{{[0-9]+}}.[[PID]].native.o.thinlto.bc{{$}}
-
-# Bare FatLTO object.
-OUTPUTS-DAG:    {{^}}foo.o.2.[[HEXPID:[a-fA-F0-9]+]].2.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}foo.o.2.[[HEXPID]].2.[[PID]].native.o.thinlto.bc{{$}}
-
-# Regular archive members.
-# Filename composition: <archive>(<member> at <offset>).<task>.<pid>.<task>.<pid>.native.o[.thinlto.bc].
-OUTPUTS-DAG:    {{^}}archive.a(boo.o at {{[0-9]+}}).3.[[HEXPID]].3.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}archive.a(boo.o at {{[0-9]+}}).3.[[HEXPID]].3.[[PID]].native.o.thinlto.bc{{$}}
-
-OUTPUTS-DAG:    {{^}}archive.a(moo.o at {{[0-9]+}}).4.[[HEXPID]].4.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}archive.a(moo.o at {{[0-9]+}}).4.[[HEXPID]].4.[[PID]].native.o.thinlto.bc{{$}}
-
-# Thin archive members.
-OUTPUTS-DAG:    {{^}}archive.thin.a(voo.o at {{[0-9]+}}).5.[[HEXPID]].5.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}archive.thin.a(voo.o at {{[0-9]+}}).5.[[HEXPID]].5.[[PID]].native.o.thinlto.bc{{$}}
-
-OUTPUTS-DAG:    {{^}}archive.thin.a(loo.o at {{[0-9]+}}).6.[[HEXPID]].6.[[PID]].native.o{{$}}
-OUTPUTS-DAG:    {{^}}archive.thin.a(loo.o at {{[0-9]+}}).6.[[HEXPID]].6.[[PID]].native.o.thinlto.bc{{$}}
-
-# Executable file.
-OUTPUTS-DAG:    {{^}}main.elf{{$}}
+RUN: ls | FileCheck %s
+
+# thin archive member: <archive>(<member> at <offset>).<task>.<pid>.<task>.<pid>.native.o
+CHECK-DAG: {{^}}boo.a(boo.o at [[#BOO_OFFSET:]]).3.[[#%X,HEXPID:]].3.[[#PID:]].native.o{{$}}
+# archive member: <archive>(<member> at <offset>).<task>.<pid>.<task>.<pid>.native.o
+CHECK-DAG: {{^}}foo.a(foo.o at [[#FOO_OFFSET:]]).2.[[#%X,HEXPID]].2.[[#PID]].native.o{{$}}
+# FatLTO object: <file>.<task>.<pid>.<task>.<pid>.native.o.
+CHECK-DAG: {{^}}start.o.1.[[#%X,HEXPID]].1.[[#PID]].native.o{{$}}
+
+# It is important that cross-module inlining occurs for this test to show that
+# Clang can successfully load the bitcode file dependencies recorded in the
+# summary indices. Explicitly check that the expected importing has occurred.
+RUN: llvm-dis *.1.*.thinlto.bc -o - | \
+RUN:   FileCheck %s --check-prefixes=OBJECTS
+RUN: llvm-dis *.2.*.thinlto.bc -o - | \
+RUN:   FileCheck %s --check-prefixes=OBJECTS
+RUN: llvm-dis *.3.*.thinlto.bc -o - | \
+RUN:   FileCheck %s --check-prefixes=OBJECTS
+
+OBJECTS-DAG: foo.o
+OBJECTS-DAG: boo.o
+OBJECTS-DAG: start.o
 
 #--- foo.c
-volatile int foo_int;
-__attribute__((retain)) int foo(int x) { return x + foo_int; }
-
+extern int boo(int), _start(int);
+__attribute__((retain)) int foo(int x) { return x + boo(x) + _start(x); }
 #--- boo.c
-extern int foo(int x);
-__attribute__((retain)) int boo(int x) { return foo(x); }
-
-#--- moo.c
-__attribute__((retain)) int moo() { return 3; }
-
-#--- loo.c
-extern int moo(int x);
-__attribute__((retain)) int loo(int x) { return moo(x); }
-
-#--- voo.c
-extern int foo(int x);
-extern int loo(int x);
-__attribute__((retain)) int voo(int x) { return foo(x) + loo(x + 1) + 7; }
-
-#--- main.c
-extern int boo(int x);
-extern int moo();
-extern int voo(int x);
-__attribute__((retain)) int main(int argc, char** argv) {
-  return boo(argc) + moo() + voo(argc + 3);
-}
+extern int foo(int), _start(int);
+__attribute__((retain)) int boo(int x) { return x + foo(x) + _start(x); }
+#--- start.c
+extern int foo(int), boo(int);
+__attribute__((retain)) int _start(int x) { return x + foo(x) + boo(x); }

>From 72fbb00d587363ec4c32ff218c5991ab3962e0ca Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 28 Jan 2026 09:59:27 +0000
Subject: [PATCH 09/12] materialize -> serializeForDistribution and add comment

---
 lld/test/ELF/dtlto/timetrace.test |  8 ++++----
 llvm/include/llvm/LTO/LTO.h       | 20 +++++++++++++++-----
 llvm/lib/DTLTO/DTLTO.cpp          |  8 ++++----
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/lld/test/ELF/dtlto/timetrace.test b/lld/test/ELF/dtlto/timetrace.test
index 58d1492f4b9cf..4567b0a1d4b02 100644
--- a/lld/test/ELF/dtlto/timetrace.test
+++ b/lld/test/ELF/dtlto/timetrace.test
@@ -32,15 +32,15 @@ RUN: %python filter_order_and_pprint.py %t.json | FileCheck %s
 ## Check that DTLTO add input file events are recorded.
 CHECK:      "name": "Add input for DTLTO"
 CHECK:      "name": "Add input for DTLTO"
-CHECK:      "name": "Materialize bitcode input for DTLTO"
-CHECK-SAME:   "detail": "t1.a(t1.bc at [[#ARCHIVE_OFFSET:]]).1.[[PID:[A-F0-9]+]].o"
 CHECK:      "name": "Remove temporary inputs for DTLTO"
+CHECK:      "name": "Serialize bitcode input for DTLTO"
+CHECK-SAME:   "detail": "t1.a(t1.bc at [[#ARCHIVE_OFFSET:]]).1.[[PID:[A-F0-9]+]].o"
 CHECK:      "name": "Total Add input for DTLTO"
 CHECK-SAME:   "count": 2,
-CHECK:      "name": "Total Materialize bitcode input for DTLTO"
-CHECK-SAME:   "count": 1,
 CHECK:      "name": "Total Remove temporary inputs for DTLTO"
 CHECK-SAME:   "count": 1,
+CHECK:      "name": "Total Serialize bitcode input for DTLTO"
+CHECK-SAME:   "count": 1,
 
 #--- t1.ll
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index d029a048e6e9f..0ec305e5519a9 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -133,7 +133,11 @@ class InputFile {
 
   MemoryBufferRef MbRef;
   bool IsFatLTOObject = false;
-  bool ShouldMaterialize = false;
+  // For distributed compilation, each input must exist as an individual bitcode
+  // file on disk and be identified by its ModuleID. Archive members and FatLTO
+  // objects violate this. So, in these cases we flag that the bitcode must be
+  // written out to a new standalone file and the ModuleID must be updated.
+  bool SerializeForDistribution = false;
   bool IsThinLTO = false;
   StringRef ArchivePath;
   StringRef MemberName;
@@ -206,10 +210,16 @@ class InputFile {
   LLVM_ABI BitcodeModule &getPrimaryBitcodeModule();
   // Returns the memory buffer reference for this input file.
   MemoryBufferRef getFileBuffer() const { return MbRef; }
-  // Returns true if this input should be materialized to disk for distribution.
-  bool shouldMaterialize() const { return ShouldMaterialize; }
-  // Mark whether this input should be materialized to disk for distribution.
-  void setShouldMaterialize(bool SM) { ShouldMaterialize = SM; }
+  // Returns true if this input should be serialized to disk for distribution.
+  // See the comment on SerializeForDistribution for details.
+  bool shouldSerializeForDistribution() const {
+    return SerializeForDistribution;
+  }
+  // Mark whether this input should be serialized to disk for distribution.
+  // See the comment on SerializeForDistribution for details.
+  void setShouldSerializeForDistribution(bool SFD) {
+    SerializeForDistribution = SFD;
+  }
   // Returns true if this bitcode came from a FatLTO object.
   bool isFatLTOObject() const { return IsFatLTOObject; }
   // Mark this bitcode as coming from a FatLTO object.
diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index 16f8ad0258d29..159685bbfb2c2 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -155,7 +155,7 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
         computeThinArchiveMemberPath(ArchivePath, Input->getMemberName());
   } else {
     // For regular archives and FatLTO objects, generate a unique name.
-    Input->setShouldMaterialize(true);
+    Input->setShouldSerializeForDistribution(true);
 
     // Create unique identifier using process ID and sequence number.
     std::string PID = utohexstr(sys::Process::getProcessId());
@@ -177,8 +177,8 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
 // previously terminated linker process and can be safely overwritten.
 Error lto::DTLTO::saveInputArchiveMember(lto::InputFile *Input) {
   StringRef ModuleId = Input->getName();
-  if (Input->shouldMaterialize()) {
-    TimeTraceScope TimeScope("Materialize bitcode input for DTLTO", ModuleId);
+  if (Input->shouldSerializeForDistribution()) {
+    TimeTraceScope TimeScope("Serialize bitcode input for DTLTO", ModuleId);
     // Cleanup this file on abnormal process exit.
     if (!SaveTemps)
       llvm::sys::RemoveFileOnSignal(ModuleId);
@@ -218,7 +218,7 @@ void lto::DTLTO::cleanup() {
   if (!SaveTemps) {
     TimeTraceScope TimeScope("Remove temporary inputs for DTLTO");
     for (auto &Input : InputFiles) {
-      if (!Input->shouldMaterialize())
+      if (!Input->shouldSerializeForDistribution())
         continue;
       std::error_code EC =
           sys::fs::remove(Input->getName(), /*IgnoreNonExisting=*/true);

>From 938fe7fa8caaa77700c9938ee50e3ba010573641 Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 28 Jan 2026 10:00:55 +0000
Subject: [PATCH 10/12] add newlines in fat dtlto test

---
 cross-project-tests/dtlto/fat-lto-objects.test | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cross-project-tests/dtlto/fat-lto-objects.test b/cross-project-tests/dtlto/fat-lto-objects.test
index c379fef8c6979..80ad7f443b2cb 100644
--- a/cross-project-tests/dtlto/fat-lto-objects.test
+++ b/cross-project-tests/dtlto/fat-lto-objects.test
@@ -45,9 +45,11 @@ OBJECTS-DAG: start.o
 #--- foo.c
 extern int boo(int), _start(int);
 __attribute__((retain)) int foo(int x) { return x + boo(x) + _start(x); }
+
 #--- boo.c
 extern int foo(int), _start(int);
 __attribute__((retain)) int boo(int x) { return x + foo(x) + _start(x); }
+
 #--- start.c
 extern int foo(int), boo(int);
 __attribute__((retain)) int _start(int x) { return x + foo(x) + boo(x); }

>From 6cf2c8ccc248f1ed4cc35a31fba4e04193b70c81 Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 28 Jan 2026 11:40:28 +0000
Subject: [PATCH 11/12] consistent names and more correct comment

---
 llvm/include/llvm/LTO/LTO.h | 6 +++---
 llvm/lib/DTLTO/DTLTO.cpp    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 0ec305e5519a9..c80993d69f7d7 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -136,7 +136,7 @@ class InputFile {
   // For distributed compilation, each input must exist as an individual bitcode
   // file on disk and be identified by its ModuleID. Archive members and FatLTO
   // objects violate this. So, in these cases we flag that the bitcode must be
-  // written out to a new standalone file and the ModuleID must be updated.
+  // written out to a new standalone file.
   bool SerializeForDistribution = false;
   bool IsThinLTO = false;
   StringRef ArchivePath;
@@ -212,12 +212,12 @@ class InputFile {
   MemoryBufferRef getFileBuffer() const { return MbRef; }
   // Returns true if this input should be serialized to disk for distribution.
   // See the comment on SerializeForDistribution for details.
-  bool shouldSerializeForDistribution() const {
+  bool getSerializeForDistribution() const {
     return SerializeForDistribution;
   }
   // Mark whether this input should be serialized to disk for distribution.
   // See the comment on SerializeForDistribution for details.
-  void setShouldSerializeForDistribution(bool SFD) {
+  void setSerializeForDistribution(bool SFD) {
     SerializeForDistribution = SFD;
   }
   // Returns true if this bitcode came from a FatLTO object.
diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index 159685bbfb2c2..4a1107e76e47b 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -155,7 +155,7 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
         computeThinArchiveMemberPath(ArchivePath, Input->getMemberName());
   } else {
     // For regular archives and FatLTO objects, generate a unique name.
-    Input->setShouldSerializeForDistribution(true);
+    Input->setSerializeForDistribution(true);
 
     // Create unique identifier using process ID and sequence number.
     std::string PID = utohexstr(sys::Process::getProcessId());
@@ -177,7 +177,7 @@ lto::DTLTO::addInput(std::unique_ptr<lto::InputFile> InputPtr) {
 // previously terminated linker process and can be safely overwritten.
 Error lto::DTLTO::saveInputArchiveMember(lto::InputFile *Input) {
   StringRef ModuleId = Input->getName();
-  if (Input->shouldSerializeForDistribution()) {
+  if (Input->getSerializeForDistribution()) {
     TimeTraceScope TimeScope("Serialize bitcode input for DTLTO", ModuleId);
     // Cleanup this file on abnormal process exit.
     if (!SaveTemps)
@@ -218,7 +218,7 @@ void lto::DTLTO::cleanup() {
   if (!SaveTemps) {
     TimeTraceScope TimeScope("Remove temporary inputs for DTLTO");
     for (auto &Input : InputFiles) {
-      if (!Input->shouldSerializeForDistribution())
+      if (!Input->getSerializeForDistribution())
         continue;
       std::error_code EC =
           sys::fs::remove(Input->getName(), /*IgnoreNonExisting=*/true);

>From 3001c08eb2f76d5b1750125827f17048e74ce84e Mon Sep 17 00:00:00 2001
From: Rose Hudson <rose.hudson at sony.com>
Date: Wed, 28 Jan 2026 13:22:06 +0000
Subject: [PATCH 12/12] fix formatting

---
 llvm/include/llvm/LTO/LTO.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index c80993d69f7d7..f992be9899e3d 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -212,14 +212,10 @@ class InputFile {
   MemoryBufferRef getFileBuffer() const { return MbRef; }
   // Returns true if this input should be serialized to disk for distribution.
   // See the comment on SerializeForDistribution for details.
-  bool getSerializeForDistribution() const {
-    return SerializeForDistribution;
-  }
+  bool getSerializeForDistribution() const { return SerializeForDistribution; }
   // Mark whether this input should be serialized to disk for distribution.
   // See the comment on SerializeForDistribution for details.
-  void setSerializeForDistribution(bool SFD) {
-    SerializeForDistribution = SFD;
-  }
+  void setSerializeForDistribution(bool SFD) { SerializeForDistribution = SFD; }
   // Returns true if this bitcode came from a FatLTO object.
   bool isFatLTOObject() const { return IsFatLTOObject; }
   // Mark this bitcode as coming from a FatLTO object.



More information about the llvm-commits mailing list