Skip to content

Commit 4312075

Browse files
authored
[nfc][thinlto] remove unnecessary return from renameModuleForThinLTO (#121851)
Same goes for `FunctionImportGlobalProcessing::run`. The return value was used, but it was always `false`.
1 parent 8cd94e0 commit 4312075

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ class FunctionImportGlobalProcessing {
120120
#endif
121121
}
122122

123-
bool run();
123+
void run();
124124
};
125125

126126
/// Perform in-place global value handling on the given Module for
127127
/// exported local functions renamed and promoted for ThinLTO.
128-
bool renameModuleForThinLTO(
128+
void renameModuleForThinLTO(
129129
Module &M, const ModuleSummaryIndex &Index,
130130
bool ClearDSOLocalOnDeclarations,
131131
SetVector<GlobalValue *> *GlobalsToImport = nullptr);

llvm/lib/LTO/ThinLTOCodeGenerator.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ generateModuleMap(std::vector<std::unique_ptr<lto::InputFile>> &Modules) {
160160

161161
static void promoteModule(Module &TheModule, const ModuleSummaryIndex &Index,
162162
bool ClearDSOLocalOnDeclarations) {
163-
if (renameModuleForThinLTO(TheModule, Index, ClearDSOLocalOnDeclarations))
164-
report_fatal_error("renameModuleForThinLTO failed");
163+
renameModuleForThinLTO(TheModule, Index, ClearDSOLocalOnDeclarations);
165164
}
166165

167166
namespace {

llvm/lib/Transforms/IPO/FunctionImport.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -1950,9 +1950,8 @@ Expected<bool> FunctionImporter::importFunctions(
19501950
SrcModule->setPartialSampleProfileRatio(Index);
19511951

19521952
// Link in the specified functions.
1953-
if (renameModuleForThinLTO(*SrcModule, Index, ClearDSOLocalOnDeclarations,
1954-
&GlobalsToImport))
1955-
return true;
1953+
renameModuleForThinLTO(*SrcModule, Index, ClearDSOLocalOnDeclarations,
1954+
&GlobalsToImport);
19561955

19571956
if (PrintImports) {
19581957
for (const auto *GV : GlobalsToImport)
@@ -2026,11 +2025,8 @@ static bool doImportingForModuleForTest(
20262025

20272026
// Next we need to promote to global scope and rename any local values that
20282027
// are potentially exported to other modules.
2029-
if (renameModuleForThinLTO(M, *Index, /*ClearDSOLocalOnDeclarations=*/false,
2030-
/*GlobalsToImport=*/nullptr)) {
2031-
errs() << "Error renaming module\n";
2032-
return true;
2033-
}
2028+
renameModuleForThinLTO(M, *Index, /*ClearDSOLocalOnDeclarations=*/false,
2029+
/*GlobalsToImport=*/nullptr);
20342030

20352031
// Perform the import now.
20362032
auto ModuleLoader = [&M](StringRef Identifier) {

llvm/lib/Transforms/Utils/FunctionImportUtils.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,12 @@ void FunctionImportGlobalProcessing::processGlobalsForThinLTO() {
331331
}
332332
}
333333

334-
bool FunctionImportGlobalProcessing::run() {
335-
processGlobalsForThinLTO();
336-
return false;
337-
}
334+
void FunctionImportGlobalProcessing::run() { processGlobalsForThinLTO(); }
338335

339-
bool llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index,
336+
void llvm::renameModuleForThinLTO(Module &M, const ModuleSummaryIndex &Index,
340337
bool ClearDSOLocalOnDeclarations,
341338
SetVector<GlobalValue *> *GlobalsToImport) {
342339
FunctionImportGlobalProcessing ThinLTOProcessing(M, Index, GlobalsToImport,
343340
ClearDSOLocalOnDeclarations);
344-
return ThinLTOProcessing.run();
341+
ThinLTOProcessing.run();
345342
}

llvm/tools/llvm-link/llvm-link.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,8 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
449449
}
450450

451451
// Promotion
452-
if (renameModuleForThinLTO(*M, *Index,
453-
/*ClearDSOLocalOnDeclarations=*/false))
454-
return true;
452+
renameModuleForThinLTO(*M, *Index,
453+
/*ClearDSOLocalOnDeclarations=*/false);
455454
}
456455

457456
if (Verbose)

0 commit comments

Comments
 (0)