[lld] [llvm] [DTLTO] support distributing bitcode from FatLTO objects (PR #176928)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 07:54:18 PST 2026
================
@@ -0,0 +1,55 @@
+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 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 --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
+
+# 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.
----------------
teresajohnson wrote:
I don't believe that this is checking that the importing occurred, just that the distributed index files contain records from the other object files, which likely means we have decided we want to import, but not that the importing succeeded. Instead you might want to llvm-dis the .import.bc files to check the IR just after importing? Or update the comment if you think that checking that these files were analyzed and included in the distributed index files is sufficient for this test.
https://github.com/llvm/llvm-project/pull/176928
More information about the llvm-commits
mailing list