Skip to content

Commit 624a047

Browse files
committed
[DTLTO] Code refactor - Fix format errors.
1 parent be5a6ce commit 624a047

5 files changed

Lines changed: 23 additions & 30 deletions

File tree

llvm/include/llvm/DTLTO/DTLTO.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ class DTLTO : public LTO {
321321
ArrayRef<StringRef> RemoteCompilerPrependArgsArg,
322322
ArrayRef<StringRef> RemoteCompilerArgsArg,
323323
StringRef LinkerOutputFileArg)
324-
: LinkerOutputFile(LinkerOutputFileArg), DistributorPath(DistributorArg),
325-
DistributorArgs(DistributorArgsArg), RemoteCompiler(RemoteCompilerArg),
324+
: LinkerOutputFile(LinkerOutputFileArg),
325+
DistributorPath(DistributorArg), DistributorArgs(DistributorArgsArg),
326+
RemoteCompiler(RemoteCompilerArg),
326327
RemoteCompilerPrependArgs(RemoteCompilerPrependArgsArg),
327328
RemoteCompilerArgs(RemoteCompilerArgsArg) {}
328329

@@ -356,8 +357,8 @@ class DTLTO : public LTO {
356357

357358
// Record a file for cleanup and register signal-time removal if requested.
358359
void addToCleanup(StringRef Filename) {
359-
CleanupList.push_back(Filename.str());
360-
sys::RemoveFileOnSignal(Filename);
360+
CleanupList.push_back(Filename.str());
361+
sys::RemoveFileOnSignal(Filename);
361362
}
362363
};
363364

llvm/include/llvm/LTO/LTO.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,24 +286,24 @@ class ThinBackendProc {
286286
virtual bool isSensitiveToInputOrder() { return false; }
287287

288288
// Write sharded indices and (optionally) imports to disk
289-
LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
290-
StringRef ModulePath,
289+
LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList,
290+
unsigned Task, StringRef ModulePath,
291291
const std::string &NewModulePath) const;
292292

293293
// Write sharded indices to SummaryPath, (optionally) imports to disk, and
294294
// (optionally) record imports in ImportsFiles. When cache key parameters are
295295
// provided and GetCacheKeysListRefFunc is set, also computes and stores the
296296
// LTO cache key for the module.
297297
LLVM_ABI Error emitFiles(
298-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, StringRef ModulePath,
299-
const std::string &NewModulePath, StringRef SummaryPath,
298+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
299+
StringRef ModulePath, const std::string &NewModulePath,
300+
StringRef SummaryPath,
300301
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
301302
const FunctionImporter::ExportSetTy *ExportList = nullptr,
302-
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR =
303-
nullptr,
303+
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>
304+
*ResolvedODR = nullptr,
304305
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs = nullptr,
305-
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr)
306-
const;
306+
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr) const;
307307
};
308308

309309
/// This callable defines the behavior of a ThinLTO backend after the thin-link
@@ -643,8 +643,6 @@ class LTO {
643643
addInput(std::unique_ptr<lto::InputFile> InputPtr) {
644644
return std::shared_ptr<lto::InputFile>(InputPtr.release());
645645
}
646-
647-
648646
};
649647

650648
/// The resolution for a symbol. The linker must provide a SymbolResolution for

llvm/lib/DTLTO/DTLTO.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ Error save(StringRef Buffer, StringRef Path) {
5454
return Error::success();
5555
}
5656

57-
// Saves the content of Input to Path overwriting any existing file.
58-
Error save(lto::InputFile *Input, StringRef Path) {
59-
MemoryBufferRef MB = Input->getFileBuffer();
60-
return save(MB.getBuffer(), Path);
61-
}
62-
6357
// Normalize and save a path. Aside from expanding Windows 8.3 short paths,
6458
// no other normalization is currently required here. These paths are
6559
// machine-local and break distribution systems; other normalization is

llvm/lib/LTO/LTO.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,23 +1488,23 @@ SmallVector<const char *> LTO::getRuntimeLibcallSymbols(const Triple &TT) {
14881488
}
14891489

14901490
Error ThinBackendProc::emitFiles(
1491-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
1492-
const std::string &NewModulePath) const {
1491+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
1492+
llvm::StringRef ModulePath, const std::string &NewModulePath) const {
14931493
return emitFiles(ImportList, Task, ModulePath, NewModulePath,
14941494
NewModulePath + ".thinlto.bc",
14951495
/*ImportsFiles=*/std::nullopt, nullptr, nullptr, nullptr,
14961496
nullptr);
14971497
}
14981498

14991499
Error ThinBackendProc::emitFiles(
1500-
const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
1501-
const std::string &NewModulePath, StringRef SummaryPath,
1500+
const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
1501+
llvm::StringRef ModulePath, const std::string &NewModulePath,
1502+
StringRef SummaryPath,
15021503
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
15031504
const FunctionImporter::ExportSetTy *ExportList,
15041505
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR,
15051506
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs,
1506-
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls)
1507-
const {
1507+
const DenseSet<GlobalValue::GUID> *CfiFunctionDecls) const {
15081508
ModuleToSummariesForIndexTy ModuleToSummariesForIndex;
15091509
GVSummaryPtrSet DeclarationSummaries;
15101510

@@ -1975,9 +1975,9 @@ class WriteIndexesThinBackend : public ThinBackendProc {
19751975
std::string NewModulePath =
19761976
getThinLTOOutputFile(ModulePath, OldPrefix, NewPrefix);
19771977
auto E = emitFiles(ImportList, Task, ModulePath, NewModulePath,
1978-
NewModulePath + ".thinlto.bc",
1979-
/*ImportsFiles=*/std::nullopt, &ExportList,
1980-
&ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
1978+
NewModulePath + ".thinlto.bc",
1979+
/*ImportsFiles=*/std::nullopt, &ExportList,
1980+
&ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
19811981
if (E) {
19821982
std::unique_lock<std::mutex> L(ErrMu);
19831983
if (Err)

llvm/tools/llvm-lto2/llvm-lto2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include "llvm/ADT/ScopeExit.h"
1919
#include "llvm/Bitcode/BitcodeReader.h"
2020
#include "llvm/CodeGen/CommandFlags.h"
21-
#include "llvm/IR/DiagnosticPrinter.h"
2221
#include "llvm/DTLTO/DTLTO.h"
22+
#include "llvm/IR/DiagnosticPrinter.h"
2323
#include "llvm/LTO/LTO.h"
2424
#include "llvm/Plugins/PassPlugin.h"
2525
#include "llvm/Remarks/HotnessThresholdParser.h"

0 commit comments

Comments
 (0)