[lld] [llvm] [DTLTO] Refactor the DTLTO code. (PR #192629)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 04:06:18 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lld/COFF/LTO.cpp lld/ELF/LTO.cpp llvm/include/llvm/DTLTO/DTLTO.h llvm/include/llvm/LTO/Config.h llvm/include/llvm/LTO/LTO.h llvm/lib/DTLTO/DTLTO.cpp llvm/lib/LTO/LTO.cpp llvm/tools/llvm-lto2/llvm-lto2.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/DTLTO/DTLTO.h b/llvm/include/llvm/DTLTO/DTLTO.h
index 248b86674..6b612f8dd 100644
--- a/llvm/include/llvm/DTLTO/DTLTO.h
+++ b/llvm/include/llvm/DTLTO/DTLTO.h
@@ -357,8 +357,8 @@ private:
// Record a file for cleanup and register signal-time removal if requested.
void addToCleanup(StringRef Filename) {
- CleanupList.push_back(Filename.str());
- sys::RemoveFileOnSignal(Filename);
+ CleanupList.push_back(Filename.str());
+ sys::RemoveFileOnSignal(Filename);
}
};
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 0cf51c3ea..5c0a85ba9 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -287,8 +287,8 @@ public:
virtual bool isSensitiveToInputOrder() { return false; }
// Write sharded indices and (optionally) imports to disk
- LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
- StringRef ModulePath,
+ LLVM_ABI Error emitFiles(const FunctionImporter::ImportMapTy &ImportList,
+ unsigned Task, StringRef ModulePath,
const std::string &NewModulePath) const;
// Write sharded indices to SummaryPath, (optionally) imports to disk, and
@@ -296,15 +296,15 @@ public:
// provided and GetCacheKeysListRefFunc is set, also computes and stores the
// LTO cache key for the module.
LLVM_ABI Error emitFiles(
- const FunctionImporter::ImportMapTy &ImportList, unsigned Task, StringRef ModulePath,
- const std::string &NewModulePath, StringRef SummaryPath,
+ const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
+ StringRef ModulePath, const std::string &NewModulePath,
+ StringRef SummaryPath,
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
const FunctionImporter::ExportSetTy *ExportList = nullptr,
- const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR =
- nullptr,
+ const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes>
+ *ResolvedODR = nullptr,
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs = nullptr,
- const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr)
- const;
+ const DenseSet<GlobalValue::GUID> *CfiFunctionDecls = nullptr) const;
};
/// This callable defines the behavior of a ThinLTO backend after the thin-link
@@ -664,8 +664,6 @@ public:
addInput(std::unique_ptr<lto::InputFile> InputPtr) {
return std::shared_ptr<lto::InputFile>(InputPtr.release());
}
-
-
};
/// The resolution for a symbol. The linker must provide a SymbolResolution for
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 1e444ca92..3b1134dd3 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -1514,8 +1514,8 @@ SmallVector<StringRef> LTO::getLibFuncSymbols(const Triple &TT,
}
Error ThinBackendProc::emitFiles(
- const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
- const std::string &NewModulePath) const {
+ const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
+ llvm::StringRef ModulePath, const std::string &NewModulePath) const {
return emitFiles(ImportList, Task, ModulePath, NewModulePath,
NewModulePath + ".thinlto.bc",
/*ImportsFiles=*/std::nullopt, nullptr, nullptr, nullptr,
@@ -1523,14 +1523,14 @@ Error ThinBackendProc::emitFiles(
}
Error ThinBackendProc::emitFiles(
- const FunctionImporter::ImportMapTy &ImportList, unsigned Task, llvm::StringRef ModulePath,
- const std::string &NewModulePath, StringRef SummaryPath,
+ const FunctionImporter::ImportMapTy &ImportList, unsigned Task,
+ llvm::StringRef ModulePath, const std::string &NewModulePath,
+ StringRef SummaryPath,
std::optional<std::reference_wrapper<ImportsFilesContainer>> ImportsFiles,
const FunctionImporter::ExportSetTy *ExportList,
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> *ResolvedODR,
const DenseSet<GlobalValue::GUID> *CfiFunctionDefs,
- const DenseSet<GlobalValue::GUID> *CfiFunctionDecls)
- const {
+ const DenseSet<GlobalValue::GUID> *CfiFunctionDecls) const {
ModuleToSummariesForIndexTy ModuleToSummariesForIndex;
GVSummaryPtrSet DeclarationSummaries;
@@ -2007,9 +2007,9 @@ public:
std::string NewModulePath =
getThinLTOOutputFile(ModulePath, OldPrefix, NewPrefix);
auto E = emitFiles(ImportList, Task, ModulePath, NewModulePath,
- NewModulePath + ".thinlto.bc",
- /*ImportsFiles=*/std::nullopt, &ExportList,
- &ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
+ NewModulePath + ".thinlto.bc",
+ /*ImportsFiles=*/std::nullopt, &ExportList,
+ &ResolvedODR, &CfiFunctionDefs, &CfiFunctionDecls);
if (E) {
std::unique_lock<std::mutex> L(ErrMu);
if (Err)
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index a0fb1b9e9..083fd0ebd 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -18,8 +18,8 @@
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/CodeGen/CommandFlags.h"
-#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/DTLTO/DTLTO.h"
+#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Plugins/PassPlugin.h"
#include "llvm/Remarks/HotnessThresholdParser.h"
``````````
</details>
https://github.com/llvm/llvm-project/pull/192629
More information about the llvm-commits
mailing list