Skip to content

[nfc][thinlto] remove unnecessary return from renameModuleForThinLTO #121851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading