Skip to content

Commit e6230cf

Browse files
committed
Remove dtlto-translate-options.ll and address some small mistakes
dtlto-translate-options.ll checks that the DTLTO code that creates Clang command lines generates the expected options and that those options are accepted by clang. I wrote it to use llvm-lto and opt so it could be part of this commit before the clang and lld patches go in. However, I think it is a nice principle to only use external tools in cross-project-tests. I have removed the test from this PR with the intention of adding it back later. Additionally if I can use the idea of storing the Clang `-c` step options and applying them to the remote backend compilations then this test will be rewritten to test that behaviour instead. Also address some minor mistakes that were identified by Teresa.
1 parent a828b70 commit e6230cf

File tree

9 files changed

+17
-186
lines changed

9 files changed

+17
-186
lines changed

cross-project-tests/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ set(CROSS_PROJECT_TEST_DEPS
1919
FileCheck
2020
check-gdb-llvm-support
2121
count
22-
llvm-config
2322
llvm-dwarfdump
24-
llvm-lto2
23+
llvm-config
2524
llvm-objdump
26-
not
27-
opt
2825
split-file
26+
not
2927
)
3028

3129
if ("clang" IN_LIST LLVM_ENABLE_PROJECTS)
@@ -96,13 +94,6 @@ add_lit_testsuite(check-cross-amdgpu "Running AMDGPU cross-project tests"
9694
DEPENDS clang
9795
)
9896

99-
# DTLTO tests.
100-
add_lit_testsuite(check-cross-dtlto "Running DTLTO cross-project tests"
101-
${CMAKE_CURRENT_BINARY_DIR}/dtlto
102-
EXCLUDE_FROM_CHECK_ALL
103-
DEPENDS ${CROSS_PROJECT_TEST_DEPS}
104-
)
105-
10697
# Add check-cross-project-* targets.
10798
add_lit_testsuites(CROSS_PROJECT ${CMAKE_CURRENT_SOURCE_DIR}
10899
DEPENDS ${CROSS_PROJECT_TEST_DEPS}

cross-project-tests/dtlto/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

cross-project-tests/dtlto/dtlto-translate-options.ll

Lines changed: 0 additions & 142 deletions
This file was deleted.

cross-project-tests/dtlto/lit.local.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

cross-project-tests/lit.cfg.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
2020

2121
# suffixes: A list of file extensions to treat as test files.
22-
config.suffixes = [".c", ".cl", ".cpp", ".m", ".ll"]
22+
config.suffixes = [".c", ".cl", ".cpp", ".m"]
2323

2424
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
2525
# subdirectories contain auxiliary inputs for various tests in their parent
@@ -96,9 +96,6 @@ def get_required_attr(config, attr_name):
9696
if lldb_path is not None:
9797
config.available_features.add("lldb")
9898

99-
for tool in ["llvm-lto2", "opt"]:
100-
if llvm_config.use_llvm_tool(tool):
101-
config.available_features.add(tool)
10299

103100
def configure_dexter_substitutions():
104101
"""Configure substitutions for host platform and return list of dependencies"""

llvm/docs/DTLTO.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ include the stem of the bitcode module, or the output file that the LTO
112112
invocation is contributing to, to aid the user in identifying them:
113113

114114
- **JSON Job Description File**:
115-
- Format: `dtlto.<UID>.dist-file.json`
115+
- Format: `dtlto.<PID>.dist-file.json`
116116
- Example: `dtlto.77380.dist-file.json` (for output file `dtlto.elf`).
117117

118118
- **Object Files From Backend Compilations**:
119-
- Format: `<Module ID stem>.<Task>.<UID>.native.o`
119+
- Format: `<Module ID stem>.<Task>.<PID>.native.o`
120120
- Example: `my.1.77380.native.o` (for bitcode module `my.o`).
121121

122122
- **Summary Index Shard Files**:
123-
- Format: `<Module ID stem>.<Task>.<UID>.native.o.thinlto.bc`
123+
- Format: `<Module ID stem>.<Task>.<PID>.native.o.thinlto.bc`
124124
- Example: `my.1.77380.native.o.thinlto.bc` (for bitcode module `my.o`).
125125

126126
Temporary files are removed, by default, after the backend compilations complete.

llvm/include/llvm/LTO/LTO.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ class ThinBackendProc {
246246
Error emitFiles(const FunctionImporter::ImportMapTy &ImportList,
247247
StringRef ModulePath, const std::string &NewModulePath) const;
248248

249-
// Write sharded indices to SummaryPath, (optionally) imports
250-
// IndexPath, and (optionally) record imports in ImportsFiles.
249+
// Write sharded indices to SummaryPath, (optionally) imports to disk, and
250+
// (optionally) record imports in ImportsFiles.
251251
Error emitFiles(const FunctionImporter::ImportMapTy &ImportList,
252252
StringRef ModulePath, StringRef SummaryPath,
253253
const std::string &NewModulePath,

llvm/lib/LTO/LTO.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ cl::list<std::string> AdditionalThinLTODistributorArgs(
9999
"thinlto-distributor-arg",
100100
cl::desc("Additional arguments to pass to the ThinLTO distributor"));
101101

102-
cl::opt<std::string>
103-
ThinLTORemoteCompiler("thinlto-remote-compiler",
104-
cl::desc("Additional arguments to pass to the "
105-
"ThinLTO remote optimization tool"));
102+
cl::opt<std::string> ThinLTORemoteCompiler(
103+
"thinlto-remote-compiler",
104+
cl::desc("Compiler to invoke for the ThinLTO backend compilations"));
106105

107106
cl::list<std::string>
108107
ThinLTORemoteCompilerArgs("thinlto-remote-compiler-arg",
@@ -2282,9 +2281,6 @@ class OutOfProcessThinBackend : public CGThinBackend {
22822281
assert(ModuleToDefinedGVSummaries.count(ModulePath));
22832282
BackendThreadPool.async(
22842283
[=](Job &J, const FunctionImporter::ImportMapTy &ImportList) {
2285-
if (LLVM_ENABLE_THREADS && Conf.TimeTraceEnabled)
2286-
timeTraceProfilerInitialize(Conf.TimeTraceGranularity,
2287-
"thin backend");
22882284
if (auto E = emitFiles(ImportList, J.ModuleID, J.SummaryIndexPath,
22892285
J.ModuleID.str(), J.ImportFiles)) {
22902286
std::unique_lock<std::mutex> L(ErrMu);
@@ -2293,8 +2289,6 @@ class OutOfProcessThinBackend : public CGThinBackend {
22932289
else
22942290
Err = std::move(E);
22952291
}
2296-
if (LLVM_ENABLE_THREADS && Conf.TimeTraceEnabled)
2297-
timeTraceProfilerFinishThread();
22982292
},
22992293
std::ref(J), std::ref(ImportList));
23002294

llvm/test/ThinLTO/X86/dtlto/imports.test

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,18 @@ INPUTS-NEXT: ]
3838
# This check ensures that we have failed for the expected reason.
3939
ERR: failed: DTLTO backend compilation: cannot open native object file:
4040

41-
# Check that imports files have not been created.
42-
RUN: ls | FileCheck %s --check-prefix=NOINDEXFILES
43-
NOINDEXFILES-NOT: imports
44-
45-
# Check that imports files are not created with -save-temps.
41+
# Check that imports files are not created even if -save-temps is active.
4642
RUN: not %{command} -save-temps 2>&1 \
4743
RUN: | FileCheck %s --check-prefixes=ERR
48-
RUN: ls | FileCheck %s --check-prefix=NOINDEXFILES
49-
NOINDEXFILES-NOT: imports
44+
RUN: ls | FileCheck %s --check-prefix=NOIMPORTFILES
45+
NOIMPORTFILES-NOT: imports
5046

5147
# Check that imports files are created with -thinlto-emit-imports.
5248
RUN: not %{command} -thinlto-emit-imports 2>&1 \
5349
RUN: | FileCheck %s --check-prefixes=ERR
54-
RUN: ls | FileCheck %s --check-prefix=INDEXFILES
55-
INDEXFILES: 0.bc.imports
56-
INDEXFILES: 1.bc.imports
50+
RUN: ls | FileCheck %s --check-prefix=IMPORTFILES
51+
IMPORTFILES: 0.bc.imports
52+
IMPORTFILES: 1.bc.imports
5753

5854
#--- 0.ll
5955
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)