[llvm] 4312075 - [nfc][thinlto] remove unnecessary return from `renameModuleForThinLTO` (#121851)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 15:19:13 PST 2025
Author: Mircea Trofin
Date: 2025-01-06T15:19:09-08:00
New Revision: 4312075efa02ad861db0a19a0db8e6003aa06965
URL: https://github.com/llvm/llvm-project/commit/4312075efa02ad861db0a19a0db8e6003aa06965
DIFF: https://github.com/llvm/llvm-project/commit/4312075efa02ad861db0a19a0db8e6003aa06965.diff
LOG: [nfc][thinlto] remove unnecessary return from `renameModuleForThinLTO` (#121851)
Same goes for `FunctionImportGlobalProcessing::run`.
The return value was used, but it was always `false`.
Added:
Modified:
llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
llvm/tools/llvm-link/llvm-link.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h b/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
index 749b7b2bb5d869..18cd923d5601d0 100644
--- a/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
@@ -120,12 +120,12 @@ class FunctionImportGlobalProcessing {
#endif
}
- bool run();
+ void run();
};
/// Perform in-place global value handling on the given Module for
/// exported local functions renamed and promoted for ThinLTO.
-bool renameModuleForThinLTO(
+void renameModuleForThinLTO(
Module &M, const ModuleSummaryIndex &Index,
bool ClearDSOLocalOnDeclarations,
SetVector<GlobalValue *> *GlobalsToImport = nullptr);
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 4522f4adcebe68..189f2876b61c0f 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -160,8 +160,7 @@ generateModuleMap(std::vector<std::unique_ptr<lto::InputFile>> &Modules) {
static void promoteModule(Module &TheModule, const ModuleSummaryIndex &Index,
bool ClearDSOLocalOnDeclarations) {
- if (renameModuleForThinLTO(TheModule, Index, ClearDSOLocalOnDeclarations))
- report_fatal_error("renameModuleForThinLTO failed");
+ renameModuleForThinLTO(TheModule, Index, ClearDSOLocalOnDeclarations);
}
namespace {
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index fde43bb354e83e..c3d0a1a3a046eb 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1950,9 +1950,8 @@ Expected<bool> FunctionImporter::importFunctions(
SrcModule->setPartialSampleProfileRatio(Index);
// Link in the specified functions.
- if (renameModuleForThinLTO(*SrcModule, Index, ClearDSOLocalOnDeclarations,
- &GlobalsToImport))
- return true;
+ renameModuleForThinLTO(*SrcModule, Index, ClearDSOLocalOnDeclarations,
+ &GlobalsToImport);
if (PrintImports) {
for (const auto *GV : GlobalsToImport)
@@ -2026,11 +2025,8 @@ static bool doImportingForModuleForTest(
// Next we need to promote to global scope and rename any local values that
// are potentially exported to other modules.
- if (renameModuleForThinLTO(M, *Index, /*ClearDSOLocalOnDeclarations=*/false,
- /*GlobalsToImport=*/nullptr)) {
- errs() << "Error renaming module\n";
- return true;
- }
+ renameModuleForThinLTO(M, *Index, /*ClearDSOLocalOnDeclarations=*/false,
+ /*GlobalsToImport=*/nullptr);
// Perform the import now.
auto ModuleLoader = [&M](StringRef Identifier) {
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
index 766c7501550da5..ae1af943bc11c7 100644
--- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
@@ -331,15 +331,12 @@ void FunctionImportGlobalProcessing::processGlobalsForThinLTO() {
}
}
-bool FunctionImportGlobalProcessing::run() {
- processGlobalsForThinLTO();
- return false;
-}
+void FunctionImportGlobalProcessing::run() { processGlobalsForThinLTO(); }
-bool llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index,
+void llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index,
bool ClearDSOLocalOnDeclarations,
SetVector<GlobalValue *> *GlobalsToImport) {
FunctionImportGlobalProcessing ThinLTOProcessing(M, Index, GlobalsToImport,
ClearDSOLocalOnDeclarations);
- return ThinLTOProcessing.run();
+ ThinLTOProcessing.run();
}
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 34bb6ce30b7668..0f4a4d57427a57 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -449,9 +449,8 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
}
// Promotion
- if (renameModuleForThinLTO(*M, *Index,
- /*ClearDSOLocalOnDeclarations=*/false))
- return true;
+ renameModuleForThinLTO(*M, *Index,
+ /*ClearDSOLocalOnDeclarations=*/false);
}
if (Verbose)
More information about the llvm-commits
mailing list