Skip to content

Commit

Permalink
[nfc][thinlto] remove unnecessary return from renameModuleForThinLTO (
Browse files Browse the repository at this point in the history
#121851)

Same goes for `FunctionImportGlobalProcessing::run`.

The return value was used, but it was always `false`.
  • Loading branch information
mtrofin authored Jan 6, 2025
1 parent 8cd94e0 commit 4312075
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
4 changes: 2 additions & 2 deletions llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 4 additions & 8 deletions llvm/lib/Transforms/IPO/FunctionImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 3 additions & 6 deletions llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
5 changes: 2 additions & 3 deletions llvm/tools/llvm-link/llvm-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4312075

Please sign in to comment.